JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS> { kind = Std.STD_JAVA_TYPE; } else if (rawType == Currency.class) { kind = Std.STD_CURRENCY; } else if (rawType == Pattern.class) { kind = Std.STD_PATTERN; } else if (rawType == Locale.class) { kind = Std.STD_LOCALE; } else if (rawType == Charset.class) { kind = Std.STD_CHARSET; } else if (rawType == TimeZone.class) { kind = Std.STD_TIME_ZONE; } else if (rawType == InetAddress.class) { kind = Std.STD_INET_ADDRESS; } else if (rawType == InetSocketAddress.class) { kind = Std.STD_INET_SOCKET_ADDRESS; } else { return null; } return new Std(rawType, kind); } /* /********************************************************** /* Deserializer implementations /********************************************************** */ @SuppressWarnings("unchecked") @Override public T deserialize(JsonParser p, DeserializationContext ctxt) throws IOException { // Issue#381 if (p.getCurrentToken() == JsonToken.START_ARRAY && ctxt.isEnabled(DeserializationFeature.UNWRAP_SINGLE_VALUE_ARRAYS)) { p.nextToken(); final T value = deserialize(p, ctxt); if (p.nextToken() != JsonToken.END_ARRAY) { throw ctxt.wrongTokenException(p, JsonToken.END_ARRAY, "Attempted to unwrap single value array for single '" + _valueClass.getName() + "' value but there was more than a single value in the array"); } return value; } // 22-Sep-2012, tatu: For 2.1, use this new method, may force coercion: String text = p.getValueAsString(); if (text != null) { // has String representation if (text.length() == 0 || (text = text.trim()).length() == 0) { // 04-Feb-2013, tatu: Usually should become null; but not always return _deserializeFromEmptyString(); } Exception cause = null; try { T result = _deserialize(text, ctxt

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS>); if (result != null) { return result; } } catch (IllegalArgumentException iae) { cause = iae; } String msg = "not a valid textual representation"; if (cause != null) { String m2 = cause.getMessage(); if (m2 != null) { msg = msg + ", problem: "+m2; } } JsonMappingException e = ctxt.weirdStringException(text, _valueClass, msg); if (cause != null) { e.initCause(cause); } throw e; // nothing to do here, yet? We'll fail anyway } if (p.getCurrentToken() == JsonToken.VALUE_EMBEDDED_OBJECT) { // Trivial cases; null to null, instance of type itself returned as is Object ob = p.getEmbeddedObject(); if (ob == null) { return null; } if (_valueClass.isAssignableFrom(ob.getClass())) { return (T) ob; } return _deserializeEmbedded(ob, ctxt); } throw ctxt.mappingException(_valueClass); } protected abstract T _deserialize(String value, DeserializationContext ctxt) throws IOException; protected T _deserializeEmbedded(Object ob, DeserializationContext ctxt) throws IOException { // default impl: error out throw ctxt.mappingException("Don't know how to convert embedded Object of type %s into %s", ob.getClass().getName(), _valueClass.getName()); } protected T _deserializeFromEmptyString() throws IOException { return null; } /* /********************************************************** /* A general-purpose implementation /********************************************************** */ /** * "Chameleon" deserializer that works on simple types that are deserialized * from a simple String. * * @since 2.4 */ public static class Std extends FromStringDeserializer<Object> { private static final long serialVersionUID = 1; public final static int STD_FILE = 1; public final static int STD_URL = 2; public final static int STD_URI = 3; public final static int STD_CLASS = 4; public final static int STD_JAVA_TYPE = 5; public final static int STD_CURRENCY = 6; public

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS>); } /* /********************************************************** /* Default JsonDeserializer implementation /********************************************************** */ /** * Because of costs associated with constructing Enum resolvers, * let's cache instances by default. */ @Override public boolean isCachable() { return true; } @Override public Object deserialize(JsonParser p, DeserializationContext ctxt) throws IOException { JsonToken curr = p.getCurrentToken(); // Usually should just get string value: if (curr == JsonToken.VALUE_STRING || curr == JsonToken.FIELD_NAME) { String name = p.getText(); Object result = _enumLookup.find(name); if (result == null) { return _deserializeAltString(p, ctxt, name); } return result; } // But let's consider int acceptable as well (if within ordinal range) if (curr == JsonToken.VALUE_NUMBER_INT) { // ... unless told not to do that int index = p.getIntValue(); if (ctxt.isEnabled(DeserializationFeature.FAIL_ON_NUMBERS_FOR_ENUMS)) { _failOnNumber(ctxt, p, index); } if (index >= 0 && index <= _enumsByIndex.length) { return _enumsByIndex[index]; } if (!ctxt.isEnabled(DeserializationFeature.READ_UNKNOWN_ENUM_VALUES_AS_NULL)) { throw ctxt.weirdNumberException(index, _enumClass(), "index value outside legal index range [0.."+(_enumsByIndex.length-1)+"]"); } return null; } return _deserializeOther(p, ctxt); } private final Object _deserializeAltString(JsonParser p, DeserializationContext ctxt, String name) throws IOException { name = name.trim(); if (name.length() == 0) { if (ctxt.isEnabled(DeserializationFeature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT)) { return null; } } else { // [databind#149]: Allow use of 'String' indexes as well char c = name.charAt(0); if (c >= '0' && c <= '9') { try { int ix = Integer.parseInt(name); if (ctxt.isEnabled

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS>(DeserializationFeature.FAIL_ON_NUMBERS_FOR_ENUMS)) { _failOnNumber(ctxt, p, ix); } if (ix >= 0 && ix <= _enumsByIndex.length) { return _enumsByIndex[ix]; } } catch (NumberFormatException e) { // fine, ignore, was not an integer } } } if (!ctxt.isEnabled(DeserializationFeature.READ_UNKNOWN_ENUM_VALUES_AS_NULL)) { throw ctxt.weirdStringException(name, _enumClass(), "value not one of declared Enum instance names: "+_enumLookup.keys()); } return null; } protected Object _deserializeOther(JsonParser p, DeserializationContext ctxt) throws IOException { JsonToken curr = p.getCurrentToken(); // [databind#381] if (ctxt.isEnabled(DeserializationFeature.UNWRAP_SINGLE_VALUE_ARRAYS) && p.isExpectedStartArrayToken()) { p.nextToken(); final Object parsed = deserialize(p, ctxt); curr = p.nextToken(); if (curr != JsonToken.END_ARRAY) { throw ctxt.wrongTokenException(p, JsonToken.END_ARRAY, "Attempted to unwrap single value array for single '" + _enumClass().getName() + "' value but there was more than a single value in the array"); } return parsed; } throw ctxt.mappingException(_enumClass()); } protected void _failOnNumber(DeserializationContext ctxt, JsonParser p, int index) throws IOException { throw InvalidFormatException.from(p, String.format("Not allowed to deserialize Enum value out of JSON number (%d): disable DeserializationConfig.DeserializationFeature.FAIL_ON_NUMBERS_FOR_ENUMS to allow", index), index, _enumClass()); } protected Class<?> _enumClass() { return handledType(); } /* /********************************************************** /* Additional helper classes /********************************************************** */ /** * Deserializer that uses a single-String static factory method * for locating Enum values by String id. */ protected static class FactoryBasedDeserializer extends StdDeserializer<Object> implements ContextualDeserializer { private static final long serialVersionUID = 1; // Marker type; null

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS> if String expected; otherwise numeric wrapper protected final Class<?> _inputType; protected final Method _factory; protected final JsonDeserializer<?> _deser; public FactoryBasedDeserializer(Class<?> cls, AnnotatedMethod f, Class<?> inputType) { super(cls); _factory = f.getAnnotated(); _inputType = inputType; _deser = null; } protected FactoryBasedDeserializer(FactoryBasedDeserializer base, JsonDeserializer<?> deser) { super(base._valueClass); _inputType = base._inputType; _factory = base._factory; _deser = deser; } @Override public JsonDeserializer<?> createContextual(DeserializationContext ctxt, BeanProperty property) throws JsonMappingException { if ((_deser == null) && (_inputType != String.class)) { return new FactoryBasedDeserializer(this, ctxt.findContextualValueDeserializer(ctxt.constructType(_inputType), property)); } return this; } @Override public Object deserialize(JsonParser p, DeserializationContext ctxt) throws IOException { Object value; if (_deser != null) { value = _deser.deserialize(p, ctxt); } else { JsonToken curr = p.getCurrentToken(); if (curr == JsonToken.VALUE_STRING || curr == JsonToken.FIELD_NAME) { value = p.getText(); } else { value = p.getValueAsString(); } } try { return _factory.invoke(_valueClass, value); } catch (Exception e) { Throwable t = ClassUtil.getRootCause(e); if (t instanceof IOException) { throw (IOException) t; } throw ctxt.instantiationException(_valueClass, t); } } @Override public Object deserializeWithType(JsonParser p, DeserializationContext ctxt, TypeDeserializer typeDeserializer) throws IOException { if (_deser == null) { // String never has type info return deserialize(p, ctxt); } return typeDeserializer.deserializeTypedFromAny(p, ctxt); } } }

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS>package com.fasterxml.jackson.databind.node; import java.io.IOException; import java.util.List; import com.fasterxml.jackson.core.*; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.SerializerProvider; import com.fasterxml.jackson.databind.jsontype.TypeSerializer; /** * This intermediate base class is used for all leaf nodes, that is, * all non-container (array or object) nodes, except for the * "missing node". */ public abstract class ValueNode extends BaseJsonNode { protected ValueNode() { } @Override protected JsonNode _at(JsonPointer ptr) { // will only allow direct matches, but no traversal through // (base class checks for direct match) return MissingNode.getInstance(); } /** * All current value nodes are immutable, so we can just return * them as is. */ @SuppressWarnings("unchecked") @Override public <T extends JsonNode> T deepCopy() { return (T) this; } @Override public abstract JsonToken asToken(); @Override public void serializeWithType(JsonGenerator jg, SerializerProvider provider, TypeSerializer typeSer) throws IOException, JsonProcessingException { typeSer.writeTypePrefixForScalar(this, jg); serialize(jg, provider); typeSer.writeTypeSuffixForScalar(this, jg); } /* /********************************************************************** /* Base impls for standard methods /********************************************************************** */ @Override public String toString() { return asText(); } /* ********************************************************************** * Navigation methods ********************************************************************** */ @Override public final JsonNode get(int index) { return null; } @Override public final JsonNode path(int index) { return MissingNode.getInstance(); } @Override public final boolean has(int index) { return false; } @Override public final boolean hasNonNull(int index) { return false; } @Override public final JsonNode get(String fieldName) { return null; } @Override public final JsonNode path(String fieldName) { return MissingNode.getInstance(); } @Override public final boolean has(String fieldName) { return false; } @Override public final boolean hasNonNull(String fieldName) { return false

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS> ctxt) throws IOException { JsonToken t = p.getCurrentToken(); if (t == JsonToken.VALUE_NULL) { return _valueDeserializer.getNullValue(ctxt); } if (_valueTypeDeserializer != null) { return _valueDeserializer.deserializeWithType(p, ctxt, _valueTypeDeserializer); } return _valueDeserializer.deserialize(p, ctxt); } /* /********************************************************** /* Helper methods /********************************************************** */ /** * Method that takes in exception of any type, and casts or wraps it * to an IOException or its subclass. */ protected void _throwAsIOE(JsonParser p, Exception e, Object value) throws IOException { if (e instanceof IllegalArgumentException) { String actType = (value == null) ? "[NULL]" : value.getClass().getName(); StringBuilder msg = new StringBuilder("Problem deserializing property '").append(getName()); msg.append("' (expected type: ").append(getType()); msg.append("; actual type: ").append(actType).append(")"); String origMsg = e.getMessage(); if (origMsg != null) { msg.append(", problem: ").append(origMsg); } else { msg.append(" (no error message provided)"); } throw JsonMappingException.from(p, msg.toString(), e); } _throwAsIOE(p, e); } /** * @since 2.7 */ protected IOException _throwAsIOE(JsonParser p, Exception e) throws IOException { if (e instanceof IOException) { throw (IOException) e; } if (e instanceof RuntimeException) { throw (RuntimeException) e; } // let's wrap the innermost problem Throwable th = e; while (th.getCause() != null) { th = th.getCause(); } throw JsonMappingException.from(p, th.getMessage(), th); } @Deprecated // since 2.7 protected IOException _throwAsIOE(Exception e) throws IOException { return _throwAsIOE((JsonParser) null, e); } // 10-Oct-2015, tatu: _Should_ be deprecated, too, but its remaining // callers can not actually provide a Json

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS>(DeserializationContext ctxt, BeanProperty property) throws JsonMappingException { // note: instead of finding key deserializer, with enums we actually // work with regular deserializers (less code duplication; but not // quite as clean as it ought to be) KeyDeserializer kd = _keyDeserializer; if (kd == null) { kd = ctxt.findKeyDeserializer(_mapType.getKeyType(), property); } JsonDeserializer<?> vd = _valueDeserializer; final JavaType vt = _mapType.getContentType(); if (vd == null) { vd = ctxt.findContextualValueDeserializer(vt, property); } else { // if directly assigned, probably not yet contextual, so: vd = ctxt.handleSecondaryContextualization(vd, property, vt); } TypeDeserializer vtd = _valueTypeDeserializer; if (vtd != null) { vtd = vtd.forProperty(property); } return withResolved(kd, vd, vtd); } /** * Because of costs associated with constructing Enum resolvers, * let's cache instances by default. */ @Override public boolean isCachable() { // Important: do NOT cache if polymorphic values return (_valueDeserializer == null) && (_keyDeserializer == null) && (_valueTypeDeserializer == null); } /* /********************************************************** /* ContainerDeserializerBase API /********************************************************** */ @Override public JavaType getContentType() { return _mapType.getContentType(); } @Override public JsonDeserializer<Object> getContentDeserializer() { return _valueDeserializer; } /* /********************************************************** /* Actual deserialization /********************************************************** */ @Override public EnumMap<?,?> deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException { // Ok: must point to START_OBJECT if (jp.getCurrentToken() != JsonToken.START_OBJECT) { return _deserializeFromEmpty(jp, ctxt); } EnumMap result = constructMap(); final JsonDeserializer<Object> valueDes = _valueDeserializer; final TypeDeserializer typeDeser = _valueTypeDeserializer; while ((jp.nextToken()) == JsonToken.FIELD_NAME) { String keyName = jp.getCurrentName(); // just for error message //

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS> but we need to let key deserializer handle it separately, nonetheless Enum<?> key = (Enum<?>) _keyDeserializer.deserializeKey(keyName, ctxt); if (key == null) { if (!ctxt.isEnabled(DeserializationFeature.READ_UNKNOWN_ENUM_VALUES_AS_NULL)) { throw ctxt.weirdStringException(keyName, _enumClass, "value not one of declared Enum instance names for " +_mapType.getKeyType()); } /* 24-Mar-2012, tatu: Null won't work as a key anyway, so let's * just skip the entry then. But we must skip the value as well, if so. */ jp.nextToken(); jp.skipChildren(); continue; } // And then the value... JsonToken t = jp.nextToken(); /* note: MUST check for nulls separately: deserializers will * not handle them (and maybe fail or return bogus data) */ Object value; try { if (t == JsonToken.VALUE_NULL) { value = valueDes.getNullValue(ctxt); } else if (typeDeser == null) { value = valueDes.deserialize(jp, ctxt); } else { value = valueDes.deserializeWithType(jp, ctxt, typeDeser); } } catch (Exception e) { wrapAndThrow(e, result, keyName); return null; } result.put(key, value); } return result; } @Override public Object deserializeWithType(JsonParser jp, DeserializationContext ctxt, TypeDeserializer typeDeserializer) throws IOException, JsonProcessingException { // In future could check current token... for now this should be enough: return typeDeserializer.deserializeTypedFromObject(jp, ctxt); } protected EnumMap<?,?> constructMap() { return new EnumMap(_enumClass); } }

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS> = typeDeser.forProperty(property); } return withResolved(typeDeser, deser); } @Override public AtomicReference<?> deserialize(JsonParser p, DeserializationContext ctxt) throws IOException { Object contents = (_valueTypeDeserializer == null) ? _valueDeserializer.deserialize(p, ctxt) : _valueDeserializer.deserializeWithType(p, ctxt, _valueTypeDeserializer); return new AtomicReference<Object>(contents); } @Override public Object deserializeWithType(JsonParser p, DeserializationContext ctxt, TypeDeserializer typeDeserializer) throws IOException { final JsonToken t = p.getCurrentToken(); if (t == JsonToken.VALUE_NULL) { // can this actually happen? return getNullValue(ctxt); } // 22-Oct-2015, tatu: This handling is probably not needed (or is wrong), but // could be result of older (pre-2.7) Jackson trying to serialize natural types. // Because of this, let's allow for now, unless proven problematic if ((t != null) && t.isScalarValue()) { return deserialize(p, ctxt); } // andn this is what should really happen return typeDeserializer.deserializeTypedFromAny(p, ctxt); } }

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS> false; FiveMinuteUser other = (FiveMinuteUser) o; if (_isVerified != other._isVerified) return false; if (_gender != other._gender) return false; if (!_name.equals(other._name)) return false; byte[] otherImage = other._userImage; if (otherImage.length != _userImage.length) return false; for (int i = 0, len = _userImage.length; i < len; ++i) { if (_userImage[i] != otherImage[i]) { return false; } } return true; } } /* /********************************************************** /* High-level helpers /********************************************************** */ protected void verifyJsonSpecSampleDoc(JsonParser jp, boolean verifyContents) throws IOException { verifyJsonSpecSampleDoc(jp, verifyContents, true); } protected void verifyJsonSpecSampleDoc(JsonParser jp, boolean verifyContents, boolean requireNumbers) throws IOException { if (!jp.hasCurrentToken()) { jp.nextToken(); } assertToken(JsonToken.START_OBJECT, jp.getCurrentToken()); // main object assertToken(JsonToken.FIELD_NAME, jp.nextToken()); // 'Image' if (verifyContents) { verifyFieldName(jp, "Image"); } assertToken(JsonToken.START_OBJECT, jp.nextToken()); // 'image' object assertToken(JsonToken.FIELD_NAME, jp.nextToken()); // 'Width' if (verifyContents) { verifyFieldName(jp, "Width"); } verifyIntToken(jp.nextToken(), requireNumbers); if (verifyContents) { verifyIntValue(jp, SAMPLE_SPEC_VALUE_WIDTH); } assertToken(JsonToken.FIELD_NAME, jp.nextToken()); // 'Height' if (verifyContents) { verifyFieldName(jp, "Height"); } verifyIntToken(jp.nextToken(), requireNumbers); if (verifyContents) { verifyIntValue(jp, SAMPLE_SPEC_VALUE_HEIGHT); } assertToken(JsonToken.FIELD_NAME, jp.nextToken()); // 'Title' if (verifyContents) { verifyFieldName(jp, "Title"); } assertToken(JsonToken.VALUE_STRING

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS>, jp.nextToken()); assertEquals(SAMPLE_SPEC_VALUE_TITLE, getAndVerifyText(jp)); assertToken(JsonToken.FIELD_NAME, jp.nextToken()); // 'Thumbnail' if (verifyContents) { verifyFieldName(jp, "Thumbnail"); } assertToken(JsonToken.START_OBJECT, jp.nextToken()); // 'thumbnail' object assertToken(JsonToken.FIELD_NAME, jp.nextToken()); // 'Url' if (verifyContents) { verifyFieldName(jp, "Url"); } assertToken(JsonToken.VALUE_STRING, jp.nextToken()); if (verifyContents) { assertEquals(SAMPLE_SPEC_VALUE_TN_URL, getAndVerifyText(jp)); } assertToken(JsonToken.FIELD_NAME, jp.nextToken()); // 'Height' if (verifyContents) { verifyFieldName(jp, "Height"); } verifyIntToken(jp.nextToken(), requireNumbers); if (verifyContents) { verifyIntValue(jp, SAMPLE_SPEC_VALUE_TN_HEIGHT); } assertToken(JsonToken.FIELD_NAME, jp.nextToken()); // 'Width' if (verifyContents) { verifyFieldName(jp, "Width"); } // Width value is actually a String in the example assertToken(JsonToken.VALUE_STRING, jp.nextToken()); if (verifyContents) { assertEquals(SAMPLE_SPEC_VALUE_TN_WIDTH, getAndVerifyText(jp)); } assertToken(JsonToken.END_OBJECT, jp.nextToken()); // 'thumbnail' object assertToken(JsonToken.FIELD_NAME, jp.nextToken()); // 'IDs' assertToken(JsonToken.START_ARRAY, jp.nextToken()); // 'ids' array verifyIntToken(jp.nextToken(), requireNumbers); // ids[0] if (verifyContents) { verifyIntValue(jp, SAMPLE_SPEC_VALUE_TN_ID1); } verifyIntToken(jp.nextToken(), requireNumbers); // ids[1] if (verifyContents) { verifyIntValue(jp, SAMPLE_SPEC_VALUE_TN_ID2); } verifyIntToken(jp.nextToken(), requireNumbers); // ids[2] if (verifyContents) { verifyIntValue(jp, SAMPLE_SPEC

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS>_VALUE_TN_ID3); } verifyIntToken(jp.nextToken(), requireNumbers); // ids[3] if (verifyContents) { verifyIntValue(jp, SAMPLE_SPEC_VALUE_TN_ID4); } assertToken(JsonToken.END_ARRAY, jp.nextToken()); // 'ids' array assertToken(JsonToken.END_OBJECT, jp.nextToken()); // 'image' object assertToken(JsonToken.END_OBJECT, jp.nextToken()); // main object } private void verifyIntToken(JsonToken t, boolean requireNumbers) { if (t == JsonToken.VALUE_NUMBER_INT) { return; } if (requireNumbers) { // to get error assertToken(JsonToken.VALUE_NUMBER_INT, t); } // if not number, must be String if (t != JsonToken.VALUE_STRING) { fail("Expected INT or STRING value, got "+t); } } protected void verifyFieldName(JsonParser jp, String expName) throws IOException { assertEquals(expName, jp.getText()); assertEquals(expName, jp.getCurrentName()); } protected void verifyIntValue(JsonParser jp, long expValue) throws IOException { // First, via textual assertEquals(String.valueOf(expValue), jp.getText()); } /** * Method that checks whether Unit tests appear to run from Ant build * scripts. * * @since 1.6 */ protected static boolean runsFromAnt() { return "true".equals(System.getProperty("FROM_ANT")); } /* /********************************************************** /* Parser/generator construction /********************************************************** */ protected JsonParser createParserUsingReader(String input) throws IOException, JsonParseException { return createParserUsingReader(new JsonFactory(), input); } protected JsonParser createParserUsingReader(JsonFactory f, String input) throws IOException, JsonParseException { return f.createParser(new StringReader(input)); } protected JsonParser createParserUsingStream(String input, String encoding) throws IOException, JsonParseException { return createParserUsingStream(new JsonFactory(), input, encoding); } protected JsonParser createParserUsingStream(JsonFactory f, String input

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS>, String encoding) throws IOException, JsonParseException { /* 23-Apr-2008, tatus: UTF-32 is not supported by JDK, have to * use our own codec too (which is not optimal since there's * a chance both encoder and decoder might have bugs, but ones * that cancel each other out or such) */ byte[] data; if (encoding.equalsIgnoreCase("UTF-32")) { data = encodeInUTF32BE(input); } else { data = input.getBytes(encoding); } InputStream is = new ByteArrayInputStream(data); return f.createParser(is); } /* /********************************************************** /* Additional assertion methods /********************************************************** */ protected void assertToken(JsonToken expToken, JsonToken actToken) { if (actToken != expToken) { fail("Expected token "+expToken+", current token "+actToken); } } protected void assertToken(JsonToken expToken, JsonParser jp) { assertToken(expToken, jp.getCurrentToken()); } protected void assertType(Object ob, Class<?> expType) { if (ob == null) { fail("Expected an object of type "+expType.getName()+", got null"); } Class<?> cls = ob.getClass(); if (!expType.isAssignableFrom(cls)) { fail("Expected type "+expType.getName()+", got "+cls.getName()); } } protected void assertValidLocation(JsonLocation location) { assertNotNull("Should have non-null location", location); assertTrue("Should have positive line number", location.getLineNr() > 0); } protected void verifyException(Throwable e, String... matches) { String msg = e.getMessage(); String lmsg = (msg == null) ? "" : msg.toLowerCase(); for (String match : matches) { String lmatch = match.toLowerCase(); if (lmsg.indexOf(lmatch) >= 0) { return; } } fail("Expected an exception with one of substrings ("+Arrays.asList(matches)+"): got one with message \""+msg+"\""); } /** * Method that gets textual contents of the current token using * available methods, and ensures results

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS> } return prop; } /** * Method needed by {@link BeanDeserializerFactory} to properly link * managed- and back-reference pairs. */ @Override public SettableBeanProperty findBackReference(String logicalName) { if (_backRefs == null) { return null; } return _backRefs.get(logicalName); } public ValueInstantiator getValueInstantiator() { return _valueInstantiator; } /* /********************************************************** /* Mutators /********************************************************** */ /** * Method that can be used to replace an existing property with * a modified one. *<p> * NOTE: only ever use this method if you know what you are doing; * incorrect usage can break deserializer. * * @param original Property to replace * @param replacement Property to replace it with * * @since 2.1 */ public void replaceProperty(SettableBeanProperty original, SettableBeanProperty replacement) { _beanProperties.replace(replacement); } /* /********************************************************** /* Partial deserializer implementation /********************************************************** */ /** * General version used when handling needs more advanced * features. */ public abstract Object deserializeFromObject(JsonParser p, DeserializationContext ctxt) throws IOException; @Override public Object deserializeWithType(JsonParser p, DeserializationContext ctxt, TypeDeserializer typeDeserializer) throws IOException { // 16-Feb-2012, tatu: ObjectId may be used as well... need to check that first if (_objectIdReader != null) { // 05-Aug-2013, tatu: May use native Object Id if (p.canReadObjectId()) { Object id = p.getObjectId(); if (id != null) { Object ob = typeDeserializer.deserializeTypedFromObject(p, ctxt); return _handleTypedObjectId(p, ctxt, ob, id); } } // or, Object Ids Jackson explicitly sets JsonToken t = p.getCurrentToken(); if (t != null) { // Most commonly, a scalar (int id, uuid String, ...) if (t.isScalarValue()) { return deserializeFromObjectId(p, ctxt); } // but,

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS> with 2.5+, a simple Object-wrapped value also legal: if (t == JsonToken.START_OBJECT) { t = p.nextToken(); } if ((t == JsonToken.FIELD_NAME) && _objectIdReader.maySerializeAsObject() && _objectIdReader.isValidReferencePropertyName(p.getCurrentName(), p)) { return deserializeFromObjectId(p, ctxt); } } } // In future could check current token... for now this should be enough: return typeDeserializer.deserializeTypedFromObject(p, ctxt); } /** * Offlined method called to handle "native" Object Id that has been read * and known to be associated with given deserialized POJO. * * @since 2.3 */ protected Object _handleTypedObjectId(JsonParser p, DeserializationContext ctxt, Object pojo, Object rawId) throws IOException { // One more challenge: type of id may not be type of property we are expecting // later on; specifically, numeric ids vs Strings. JsonDeserializer<Object> idDeser = _objectIdReader.getDeserializer(); final Object id; // Ok, this is bit ridiculous; let's see if conversion is needed: if (idDeser.handledType() == rawId.getClass()) { // nope: already same type id = rawId; } else { id = _convertObjectId(p, ctxt, rawId, idDeser); } ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(pojo); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(pojo, id); } return pojo; } /** * Helper method we need to do necessary conversion from whatever native object id * type is, into declared type that Jackson internals expect. This may be * simple cast (for String ids), or something more complicated; in latter * case we may need to create bogus content buffer to allow use of * id deserializer. * * @since 2.3 */ @SuppressWarnings("

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS>.instantiationException(handledType(), "no suitable creator method found to deserialize from JSON floating-point number"); } /** * Method called to deserialize POJO value from a JSON boolean value (true, false) */ public Object deserializeFromBoolean(JsonParser p, DeserializationContext ctxt) throws IOException { if (_delegateDeserializer != null) { if (!_valueInstantiator.canCreateFromBoolean()) { Object bean = _valueInstantiator.createUsingDelegate(ctxt, _delegateDeserializer.deserialize(p, ctxt)); if (_injectables != null) { injectValues(ctxt, bean); } return bean; } } boolean value = (p.getCurrentToken() == JsonToken.VALUE_TRUE); return _valueInstantiator.createFromBoolean(ctxt, value); } public Object deserializeFromArray(JsonParser p, DeserializationContext ctxt) throws IOException { if (_arrayDelegateDeserializer != null) { try { Object bean = _valueInstantiator.createUsingArrayDelegate(ctxt, _arrayDelegateDeserializer.deserialize(p, ctxt)); if (_injectables != null) { injectValues(ctxt, bean); } return bean; } catch (Exception e) { wrapInstantiationProblem(e, ctxt); } } // fallback to non-array delegate if (_delegateDeserializer != null) { try { Object bean = _valueInstantiator.createUsingArrayDelegate(ctxt, _delegateDeserializer.deserialize(p, ctxt)); if (_injectables != null) { injectValues(ctxt, bean); } return bean; } catch (Exception e) { wrapInstantiationProblem(e, ctxt); } } if (ctxt.isEnabled(DeserializationFeature.UNWRAP_SINGLE_VALUE_ARRAYS)) { JsonToken t = p.nextToken(); if (t == JsonToken.END_ARRAY && ctxt.isEnabled(DeserializationFeature.ACCEPT_EMPTY_ARRAY_AS_NULL_OBJECT)) { return null; } final Object value = deserialize(p, ctxt); if (p.nextToken() != JsonToken.END_ARRAY) { throw ctxt.wrongTokenException(p, JsonToken.END_ARRAY, "Attempted to unwrap single value array for single '" + _valueClass.getName() + "' value but there was more than

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS> a single value in the array"); } return value; } if (ctxt.isEnabled(DeserializationFeature.ACCEPT_EMPTY_ARRAY_AS_NULL_OBJECT)) { JsonToken t = p.nextToken(); if (t == JsonToken.END_ARRAY) { return null; } throw ctxt.mappingException(handledType(), JsonToken.START_ARRAY); } throw ctxt.mappingException(handledType()); } public Object deserializeFromEmbedded(JsonParser p, DeserializationContext ctxt) throws IOException { // First things first: id Object Id is used, most likely that's it; specifically, // true for UUIDs when written as binary (with Smile, other binary formats) if (_objectIdReader != null) { return deserializeFromObjectId(p, ctxt); } // TODO: maybe add support for ValueInstantiator, embedded? return p.getEmbeddedObject(); } /* /********************************************************** /* Overridable helper methods /********************************************************** */ protected void injectValues(DeserializationContext ctxt, Object bean) throws IOException { for (ValueInjector injector : _injectables) { injector.inject(ctxt, bean); } } /** * Method called to handle set of one or more unknown properties, * stored in their entirety in given {@link TokenBuffer} * (as field entries, name and value). */ @SuppressWarnings("resource") protected Object handleUnknownProperties(DeserializationContext ctxt, Object bean, TokenBuffer unknownTokens) throws IOException { // First: add closing END_OBJECT as marker unknownTokens.writeEndObject(); // note: buffer does NOT have starting START_OBJECT JsonParser bufferParser = unknownTokens.asParser(); while (bufferParser.nextToken() != JsonToken.END_OBJECT) { String propName = bufferParser.getCurrentName(); // Unknown: let's call handler method bufferParser.nextToken(); handleUnknownProperty(bufferParser, ctxt, bean, propName); } return bean; } /** * Helper method called for an unknown property, when using "vanilla" * processing. */ protected void handleUnknownVanilla(JsonParser p, DeserializationContext ctxt, Object bean, String propName) throws IOException { if (_ignorableProps != null

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS>package com.fasterxml.jackson.databind.node; import java.io.IOException; import com.fasterxml.jackson.core.*; import com.fasterxml.jackson.databind.SerializerProvider; /** * This concrete value class is used to contain boolean (true / false) * values. Only two instances are ever created, to minimize memory * usage. */ public class BooleanNode extends ValueNode { // // Just need two instances... public final static BooleanNode TRUE = new BooleanNode(true); public final static BooleanNode FALSE = new BooleanNode(false); private final boolean _value; private BooleanNode(boolean v) { _value = v; } public static BooleanNode getTrue() { return TRUE; } public static BooleanNode getFalse() { return FALSE; } public static BooleanNode valueOf(boolean b) { return b ? TRUE : FALSE; } @Override public JsonNodeType getNodeType() { return JsonNodeType.BOOLEAN; } @Override public JsonToken asToken() { return _value ? JsonToken.VALUE_TRUE : JsonToken.VALUE_FALSE; } @Override public boolean booleanValue() { return _value; } @Override public String asText() { return _value ? "true" : "false"; } @Override public boolean asBoolean() { return _value; } @Override public boolean asBoolean(boolean defaultValue) { return _value; } @Override public int asInt(int defaultValue) { return _value ? 1 : 0; } @Override public long asLong(long defaultValue) { return _value ? 1L : 0L; } @Override public double asDouble(double defaultValue) { return _value ? 1.0 : 0.0; } @Override public final void serialize(JsonGenerator g, SerializerProvider provider) throws IOException { g.writeBoolean(_value); } @Override public int hashCode() { return _value ? 3 : 1; } @Override public boolean equals(Object o) { /* 11-Mar-2013, tatu: Apparently ClassLoaders can manage to load * different instances, rendering identity comparisons broken

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS> return (_valueDeserializer == null) && (_keyDeserializer == null) && (_valueTypeDeserializer == null) && (_ignorableProperties == null); } @Override @SuppressWarnings("unchecked") public Map<Object,Object> deserialize(JsonParser p, DeserializationContext ctxt) throws IOException { if (_propertyBasedCreator != null) { return _deserializeUsingCreator(p, ctxt); } if (_delegateDeserializer != null) { return (Map<Object,Object>) _valueInstantiator.createUsingDelegate(ctxt, _delegateDeserializer.deserialize(p, ctxt)); } if (!_hasDefaultCreator) { throw ctxt.instantiationException(getMapClass(), "No default constructor found"); } // Ok: must point to START_OBJECT, FIELD_NAME or END_OBJECT JsonToken t = p.getCurrentToken(); if (t != JsonToken.START_OBJECT && t != JsonToken.FIELD_NAME && t != JsonToken.END_OBJECT) { // [JACKSON-620] (empty) String may be ok however: if (t == JsonToken.VALUE_STRING) { return (Map<Object,Object>) _valueInstantiator.createFromString(ctxt, p.getText()); } // slightly redundant (since String was passed above), but return _deserializeFromEmpty(p, ctxt); } final Map<Object,Object> result = (Map<Object,Object>) _valueInstantiator.createUsingDefault(ctxt); if (_standardStringKey) { _readAndBindStringMap(p, ctxt, result); return result; } _readAndBind(p, ctxt, result); return result; } @Override public Map<Object,Object> deserialize(JsonParser p, DeserializationContext ctxt, Map<Object,Object> result) throws IOException { // [databind#631]: Assign current value, to be accessible by custom serializers p.setCurrentValue(result); // Ok: must point to START_OBJECT or FIELD_NAME JsonToken t = p.getCurrentToken(); if (t != JsonToken.START_OBJECT && t != JsonToken.FIELD_NAME) { throw ctxt.mappingException(getMapClass()); } if (_standardStringKey) { _readAnd

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS>BindStringMap(p, ctxt, result); return result; } _readAndBind(p, ctxt, result); return result; } @Override public Object deserializeWithType(JsonParser jp, DeserializationContext ctxt, TypeDeserializer typeDeserializer) throws IOException, JsonProcessingException { // In future could check current token... for now this should be enough: return typeDeserializer.deserializeTypedFromObject(jp, ctxt); } /* /********************************************************** /* Other public accessors /********************************************************** */ @SuppressWarnings("unchecked") public final Class<?> getMapClass() { return (Class<Map<Object,Object>>) _mapType.getRawClass(); } @Override public JavaType getValueType() { return _mapType; } /* /********************************************************** /* Internal methods /********************************************************** */ protected final void _readAndBind(JsonParser p, DeserializationContext ctxt, Map<Object,Object> result) throws IOException { final KeyDeserializer keyDes = _keyDeserializer; final JsonDeserializer<Object> valueDes = _valueDeserializer; final TypeDeserializer typeDeser = _valueTypeDeserializer; MapReferringAccumulator referringAccumulator = null; boolean useObjectId = valueDes.getObjectIdReader() != null; if (useObjectId) { referringAccumulator = new MapReferringAccumulator(_mapType.getContentType().getRawClass(), result); } String keyStr; if (p.isExpectedStartObjectToken()) { keyStr = p.nextFieldName(); } else { JsonToken t = p.getCurrentToken(); if (t == JsonToken.END_OBJECT) { return; } if (t != JsonToken.FIELD_NAME) { throw ctxt.mappingException(_mapType.getRawClass(), p.getCurrentToken()); } keyStr = p.getCurrentName(); } for (; keyStr != null; keyStr = p.nextFieldName()) { Object key = keyDes.deserializeKey(keyStr, ctxt); // And then the value... JsonToken t = p.nextToken(); if (_ignorableProperties != null && _ignorableProperties.contains(keyStr)) { p.skipChildren(); continue; } try { // Note: must handle null explicitly here; value deserializers won't Object value;

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS> if (t == JsonToken.VALUE_NULL) { value = valueDes.getNullValue(ctxt); } else if (typeDeser == null) { value = valueDes.deserialize(p, ctxt); } else { value = valueDes.deserializeWithType(p, ctxt, typeDeser); } if (useObjectId) { referringAccumulator.put(key, value); } else { result.put(key, value); } } catch (UnresolvedForwardReference reference) { handleUnresolvedReference(p, referringAccumulator, key, reference); } catch (Exception e) { wrapAndThrow(e, result, keyStr); } } } /** * Optimized method used when keys can be deserialized as plain old * {@link java.lang.String}s, and there is no custom deserialized * specified. */ protected final void _readAndBindStringMap(JsonParser p, DeserializationContext ctxt, Map<Object,Object> result) throws IOException { final JsonDeserializer<Object> valueDes = _valueDeserializer; final TypeDeserializer typeDeser = _valueTypeDeserializer; MapReferringAccumulator referringAccumulator = null; boolean useObjectId = (valueDes.getObjectIdReader() != null); if (useObjectId) { referringAccumulator = new MapReferringAccumulator(_mapType.getContentType().getRawClass(), result); } String key; if (p.isExpectedStartObjectToken()) { key = p.nextFieldName(); } else { JsonToken t = p.getCurrentToken(); if (t == JsonToken.END_OBJECT) { return; } if (t != JsonToken.FIELD_NAME) { throw ctxt.mappingException(_mapType.getRawClass(), p.getCurrentToken()); } key = p.getCurrentName(); } for (; key != null; key = p.nextFieldName()) { JsonToken t = p.nextToken(); if (_ignorableProperties != null && _ignorableProperties.contains(key)) { p.skipChildren(); continue; } try { // Note: must handle null explicitly here; value deserializers won't Object value; if (t == JsonToken.VALUE_NULL) { value = valueDes.getNullValue(ctxt);

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS> } else if (typeDeser == null) { value = valueDes.deserialize(p, ctxt); } else { value = valueDes.deserializeWithType(p, ctxt, typeDeser); } if (useObjectId) { referringAccumulator.put(key, value); } else { result.put(key, value); } } catch (UnresolvedForwardReference reference) { handleUnresolvedReference(p, referringAccumulator, key, reference); } catch (Exception e) { wrapAndThrow(e, result, key); } } // 23-Mar-2015, tatu: TODO: verify we got END_OBJECT? } @SuppressWarnings("unchecked") public Map<Object,Object> _deserializeUsingCreator(JsonParser p, DeserializationContext ctxt) throws IOException { final PropertyBasedCreator creator = _propertyBasedCreator; // null -> no ObjectIdReader for Maps (yet?) PropertyValueBuffer buffer = creator.startBuilding(p, ctxt, null); final JsonDeserializer<Object> valueDes = _valueDeserializer; final TypeDeserializer typeDeser = _valueTypeDeserializer; String key; if (p.isExpectedStartObjectToken()) { key = p.nextFieldName(); } else if (p.hasToken(JsonToken.FIELD_NAME)) { key = p.getCurrentName(); } else { key = null; } for (; key != null; key = p.nextFieldName()) { JsonToken t = p.nextToken(); // to get to value if (_ignorableProperties != null && _ignorableProperties.contains(key)) { p.skipChildren(); // and skip it (in case of array/object) continue; } // creator property? SettableBeanProperty prop = creator.findCreatorProperty(key); if (prop != null) { // Last property to set? if (buffer.assignParameter(prop, prop.deserialize(p, ctxt))) { p.nextToken(); Map<Object,Object> result; try { result = (Map<Object,Object>)creator.build(ctxt, buffer); } catch (Exception e) { wrapAndThrow(e, _mapType.getRawClass(), key); return null; } _readAndBind

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS>(p, ctxt, result); return result; } continue; } // other property? needs buffering Object actualKey = _keyDeserializer.deserializeKey(key, ctxt); Object value; try { if (t == JsonToken.VALUE_NULL) { value = valueDes.getNullValue(ctxt); } else if (typeDeser == null) { value = valueDes.deserialize(p, ctxt); } else { value = valueDes.deserializeWithType(p, ctxt, typeDeser); } } catch (Exception e) { wrapAndThrow(e, _mapType.getRawClass(), key); return null; } buffer.bufferMapProperty(actualKey, value); } // end of JSON object? // if so, can just construct and leave... try { return (Map<Object,Object>)creator.build(ctxt, buffer); } catch (Exception e) { wrapAndThrow(e, _mapType.getRawClass(), key); return null; } } @Deprecated // since 2.5 protected void wrapAndThrow(Throwable t, Object ref) throws IOException { wrapAndThrow(t, ref, null); } private void handleUnresolvedReference(JsonParser jp, MapReferringAccumulator accumulator, Object key, UnresolvedForwardReference reference) throws JsonMappingException { if (accumulator == null) { throw JsonMappingException.from(jp, "Unresolved forward reference but no identity info.", reference); } Referring referring = accumulator.handleUnresolvedReference(reference, key); reference.getRoid().appendReferring(referring); } private final static class MapReferringAccumulator { private final Class<?> _valueType; private Map<Object,Object> _result; /** * A list of {@link MapReferring} to maintain ordering. */ private List<MapReferring> _accumulator = new ArrayList<MapReferring>(); public MapReferringAccumulator(Class<?> valueType, Map<Object, Object> result) { _valueType = valueType; _result = result; } public void put(Object key, Object value) { if (_accumulator.isEmpty()) { _result.put(key, value); } else { Map

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS> _buildMethod = src._buildMethod; } protected BuilderBasedDeserializer(BuilderBasedDeserializer src, NameTransformer unwrapper) { super(src, unwrapper); _buildMethod = src._buildMethod; } public BuilderBasedDeserializer(BuilderBasedDeserializer src, ObjectIdReader oir) { super(src, oir); _buildMethod = src._buildMethod; } public BuilderBasedDeserializer(BuilderBasedDeserializer src, HashSet<String> ignorableProps) { super(src, ignorableProps); _buildMethod = src._buildMethod; } @Override public JsonDeserializer<Object> unwrappingDeserializer(NameTransformer unwrapper) { /* main thing really is to just enforce ignoring of unknown * properties; since there may be multiple unwrapped values * and properties for all may be interleaved... */ return new BuilderBasedDeserializer(this, unwrapper); } @Override public BuilderBasedDeserializer withObjectIdReader(ObjectIdReader oir) { return new BuilderBasedDeserializer(this, oir); } @Override public BuilderBasedDeserializer withIgnorableProperties(HashSet<String> ignorableProps) { return new BuilderBasedDeserializer(this, ignorableProps); } @Override protected BeanAsArrayBuilderDeserializer asArrayDeserializer() { SettableBeanProperty[] props = _beanProperties.getPropertiesInInsertionOrder(); return new BeanAsArrayBuilderDeserializer(this, props, _buildMethod); } /* /********************************************************** /* JsonDeserializer implementation /********************************************************** */ protected final Object finishBuild(DeserializationContext ctxt, Object builder) throws IOException { // As per [databind#777], allow returning builder itself if (null == _buildMethod) { return builder; } try { return _buildMethod.getMember().invoke(builder); } catch (Exception e) { wrapInstantiationProblem(e, ctxt); return null; } } /** * Main deserialization method for bean-based objects (POJOs). */ @Override public final Object deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException { JsonToken t = jp.getCurrentToken(); // common case first: if (t == JsonToken.START_OBJECT) { t = jp.nextToken();

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS> } if (_needViewProcesing) { Class<?> view = ctxt.getActiveView(); if (view != null) { return deserializeWithView(jp, ctxt, builder, view); } } JsonToken t = jp.getCurrentToken(); // 23-Mar-2010, tatu: In some cases, we start with full JSON object too... if (t == JsonToken.START_OBJECT) { t = jp.nextToken(); } for (; t == JsonToken.FIELD_NAME; t = jp.nextToken()) { String propName = jp.getCurrentName(); // Skip field name: jp.nextToken(); SettableBeanProperty prop = _beanProperties.find(propName); if (prop != null) { // normal case try { builder = prop.deserializeSetAndReturn(jp, ctxt, builder); } catch (Exception e) { wrapAndThrow(e, builder, propName, ctxt); } continue; } handleUnknownVanilla(jp, ctxt, handledType(), propName); } return builder; } /** * Streamlined version that is only used when no "special" * features are enabled. */ private final Object vanillaDeserialize(JsonParser jp, DeserializationContext ctxt, JsonToken t) throws IOException, JsonProcessingException { Object bean = _valueInstantiator.createUsingDefault(ctxt); for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) { String propName = jp.getCurrentName(); // Skip field name: jp.nextToken(); SettableBeanProperty prop = _beanProperties.find(propName); if (prop != null) { // normal case try { bean = prop.deserializeSetAndReturn(jp, ctxt, bean); } catch (Exception e) { wrapAndThrow(e, bean, propName, ctxt); } } else { handleUnknownVanilla(jp, ctxt, bean, propName); } } return bean; } /** * General version used when handling needs more advanced * features. */ @Override public Object deserializeFromObject(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException { if (_nonStandardCreation

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS>) { if (_unwrappedPropertyHandler != null) { return deserializeWithUnwrapped(jp, ctxt); } if (_externalTypeIdHandler != null) { return deserializeWithExternalTypeId(jp, ctxt); } return deserializeFromObjectUsingNonDefault(jp, ctxt); } Object bean = _valueInstantiator.createUsingDefault(ctxt); if (_injectables != null) { injectValues(ctxt, bean); } if (_needViewProcesing) { Class<?> view = ctxt.getActiveView(); if (view != null) { return deserializeWithView(jp, ctxt, bean, view); } } for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) { String propName = jp.getCurrentName(); // Skip field name: jp.nextToken(); SettableBeanProperty prop = _beanProperties.find(propName); if (prop != null) { // normal case try { bean = prop.deserializeSetAndReturn(jp, ctxt, bean); } catch (Exception e) { wrapAndThrow(e, bean, propName, ctxt); } continue; } handleUnknownVanilla(jp, ctxt, bean, propName); } return bean; } /** * Method called to deserialize bean using "property-based creator": * this means that a non-default constructor or factory method is * called, and then possibly other setters. The trick is that * values for creator method need to be buffered, first; and * due to non-guaranteed ordering possibly some other properties * as well. */ @Override @SuppressWarnings("resource") protected final Object _deserializeUsingPropertyBased(final JsonParser jp, final DeserializationContext ctxt) throws IOException, JsonProcessingException { final PropertyBasedCreator creator = _propertyBasedCreator; PropertyValueBuffer buffer = creator.startBuilding(jp, ctxt, _objectIdReader); // 04-Jan-2010, tatu: May need to collect unknown properties for polymorphic cases TokenBuffer unknown = null; JsonToken t = jp.getCurrentToken(); for (; t == JsonToken.FIELD_NAME; t = jp.nextToken()) { String propName = jp.getCurrentName(); jp

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS> e) { wrapInstantiationProblem(e, ctxt); return null; // never gets here } if (unknown != null) { // polymorphic? if (bean.getClass() != _beanType.getRawClass()) { return handlePolymorphic(null, ctxt, bean, unknown); } // no, just some extra unknown properties return handleUnknownProperties(ctxt, bean, unknown); } return bean; } /* /********************************************************** /* Deserializing when we have to consider an active View /********************************************************** */ protected final Object deserializeWithView(JsonParser jp, DeserializationContext ctxt, Object bean, Class<?> activeView) throws IOException, JsonProcessingException { JsonToken t = jp.getCurrentToken(); for (; t == JsonToken.FIELD_NAME; t = jp.nextToken()) { String propName = jp.getCurrentName(); // Skip field name: jp.nextToken(); SettableBeanProperty prop = _beanProperties.find(propName); if (prop != null) { if (!prop.visibleInView(activeView)) { jp.skipChildren(); continue; } try { bean = prop.deserializeSetAndReturn(jp, ctxt, bean); } catch (Exception e) { wrapAndThrow(e, bean, propName, ctxt); } continue; } handleUnknownVanilla(jp, ctxt, bean, propName); } return bean; } /* /********************************************************** /* Handling for cases where we have "unwrapped" values /********************************************************** */ /** * Method called when there are declared "unwrapped" properties * which need special handling */ @SuppressWarnings("resource") protected Object deserializeWithUnwrapped(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException { if (_delegateDeserializer != null) { return _valueInstantiator.createUsingDelegate(ctxt, _delegateDeserializer.deserialize(jp, ctxt)); } if (_propertyBasedCreator != null) { return deserializeUsingPropertyBasedWithUnwrapped(jp, ctxt); } TokenBuffer tokens = new TokenBuffer(jp, ctxt); tokens.writeStartObject(); Object bean = _valueInstantiator.createUsingDefault(ctxt); if (_injectables != null) {

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS> injectValues(ctxt, bean); } final Class<?> activeView = _needViewProcesing ? ctxt.getActiveView() : null; for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) { String propName = jp.getCurrentName(); jp.nextToken(); SettableBeanProperty prop = _beanProperties.find(propName); if (prop != null) { // normal case if (activeView != null && !prop.visibleInView(activeView)) { jp.skipChildren(); continue; } try { bean = prop.deserializeSetAndReturn(jp, ctxt, bean); } catch (Exception e) { wrapAndThrow(e, bean, propName, ctxt); } continue; } // ignorable things should be ignored if (_ignorableProps != null && _ignorableProps.contains(propName)) { handleIgnoredProperty(jp, ctxt, bean, propName); continue; } // but... others should be passed to unwrapped property deserializers tokens.writeFieldName(propName); tokens.copyCurrentStructure(jp); // how about any setter? We'll get copies but... if (_anySetter != null) { try { _anySetter.deserializeAndSet(jp, ctxt, bean, propName); } catch (Exception e) { wrapAndThrow(e, bean, propName, ctxt); } continue; } } tokens.writeEndObject(); _unwrappedPropertyHandler.processUnwrapped(jp, ctxt, bean, tokens); return bean; } @SuppressWarnings("resource") protected Object deserializeWithUnwrapped(JsonParser jp, DeserializationContext ctxt, Object bean) throws IOException, JsonProcessingException { JsonToken t = jp.getCurrentToken(); if (t == JsonToken.START_OBJECT) { t = jp.nextToken(); } TokenBuffer tokens = new TokenBuffer(jp, ctxt); tokens.writeStartObject(); final Class<?> activeView = _needViewProcesing ? ctxt.getActiveView() : null; for (; t == JsonToken.FIELD_NAME; t = jp.nextToken()) { String propName = jp.getCurrentName(); SettableBeanProperty prop = _beanProperties.find(prop

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS>Name); jp.nextToken(); if (prop != null) { // normal case if (activeView != null && !prop.visibleInView(activeView)) { jp.skipChildren(); continue; } try { bean = prop.deserializeSetAndReturn(jp, ctxt, bean); } catch (Exception e) { wrapAndThrow(e, bean, propName, ctxt); } continue; } if (_ignorableProps != null && _ignorableProps.contains(propName)) { handleIgnoredProperty(jp, ctxt, bean, propName); continue; } // but... others should be passed to unwrapped property deserializers tokens.writeFieldName(propName); tokens.copyCurrentStructure(jp); // how about any setter? We'll get copies but... if (_anySetter != null) { _anySetter.deserializeAndSet(jp, ctxt, bean, propName); } } tokens.writeEndObject(); _unwrappedPropertyHandler.processUnwrapped(jp, ctxt, bean, tokens); return bean; } @SuppressWarnings("resource") protected Object deserializeUsingPropertyBasedWithUnwrapped(JsonParser p, DeserializationContext ctxt) throws IOException, JsonProcessingException { final PropertyBasedCreator creator = _propertyBasedCreator; PropertyValueBuffer buffer = creator.startBuilding(p, ctxt, _objectIdReader); TokenBuffer tokens = new TokenBuffer(p, ctxt); tokens.writeStartObject(); JsonToken t = p.getCurrentToken(); for (; t == JsonToken.FIELD_NAME; t = p.nextToken()) { String propName = p.getCurrentName(); p.nextToken(); // to point to value // creator property? SettableBeanProperty creatorProp = creator.findCreatorProperty(propName); if (creatorProp != null) { // Last creator property to set? if (buffer.assignParameter(creatorProp, creatorProp.deserialize(p, ctxt))) { t = p.nextToken(); // to move to following FIELD_NAME/END_OBJECT Object bean; try { bean = creator.build(ctxt, buffer); } catch (Exception e) { wrapAndThrow(e, _beanType.getRawClass(), propName, ctxt); continue; // never gets here

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS> } // if so, need to copy all remaining tokens into buffer while (t == JsonToken.FIELD_NAME) { p.nextToken(); // to skip name tokens.copyCurrentStructure(p); t = p.nextToken(); } tokens.writeEndObject(); if (bean.getClass() != _beanType.getRawClass()) { // !!! 08-Jul-2011, tatu: Could probably support; but for now // it's too complicated, so bail out throw ctxt.mappingException("Can not create polymorphic instances with unwrapped values"); } return _unwrappedPropertyHandler.processUnwrapped(p, ctxt, bean, tokens); } continue; } // Object Id property? if (buffer.readIdProperty(propName)) { continue; } // regular property? needs buffering SettableBeanProperty prop = _beanProperties.find(propName); if (prop != null) { buffer.bufferProperty(prop, prop.deserialize(p, ctxt)); continue; } if (_ignorableProps != null && _ignorableProps.contains(propName)) { handleIgnoredProperty(p, ctxt, handledType(), propName); continue; } tokens.writeFieldName(propName); tokens.copyCurrentStructure(p); // "any property"? if (_anySetter != null) { buffer.bufferAnyProperty(_anySetter, propName, _anySetter.deserialize(p, ctxt)); } } // We hit END_OBJECT, so: Object bean; // !!! 15-Feb-2012, tatu: Need to modify creator to use Builder! try { bean = creator.build(ctxt, buffer); } catch (Exception e) { wrapInstantiationProblem(e, ctxt); return null; // never gets here } return _unwrappedPropertyHandler.processUnwrapped(p, ctxt, bean, tokens); } /* /********************************************************** /* Handling for cases where we have property/-ies with /* external type id /********************************************************** */ protected Object deserializeWithExternalTypeId(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException { if (_propertyBasedCreator != null) { return deserializeUsingProperty

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS>BasedWithExternalTypeId(jp, ctxt); } return deserializeWithExternalTypeId(jp, ctxt, _valueInstantiator.createUsingDefault(ctxt)); } protected Object deserializeWithExternalTypeId(JsonParser jp, DeserializationContext ctxt, Object bean) throws IOException, JsonProcessingException { final Class<?> activeView = _needViewProcesing ? ctxt.getActiveView() : null; final ExternalTypeHandler ext = _externalTypeIdHandler.start(); for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) { String propName = jp.getCurrentName(); jp.nextToken(); SettableBeanProperty prop = _beanProperties.find(propName); if (prop != null) { // normal case if (activeView != null && !prop.visibleInView(activeView)) { jp.skipChildren(); continue; } try { bean = prop.deserializeSetAndReturn(jp, ctxt, bean); } catch (Exception e) { wrapAndThrow(e, bean, propName, ctxt); } continue; } // ignorable things should be ignored if (_ignorableProps != null && _ignorableProps.contains(propName)) { handleIgnoredProperty(jp, ctxt, bean, propName); continue; } // but others are likely to be part of external type id thingy... if (ext.handlePropertyValue(jp, ctxt, propName, bean)) { continue; } // if not, the usual fallback handling: if (_anySetter != null) { try { _anySetter.deserializeAndSet(jp, ctxt, bean, propName); } catch (Exception e) { wrapAndThrow(e, bean, propName, ctxt); } continue; } else { // Unknown: let's call handler method handleUnknownProperty(jp, ctxt, bean, propName); } } // and when we get this far, let's try finalizing the deal: return ext.complete(jp, ctxt, bean); } protected Object deserializeUsingPropertyBasedWithExternalTypeId(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException { // !!! 04-Mar-2012, TODO: Need to fix -- will not

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS>package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import java.lang.reflect.Method; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.core.JsonToken; import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.SettableBeanProperty; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; import com.fasterxml.jackson.databind.introspect.AnnotatedMethod; import com.fasterxml.jackson.databind.introspect.BeanPropertyDefinition; import com.fasterxml.jackson.databind.jsontype.TypeDeserializer; import com.fasterxml.jackson.databind.util.Annotations; /** * This concrete sub-class implements Collection or Map property that is * indirectly by getting the property value and directly modifying it. */ public final class SetterlessProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; protected final AnnotatedMethod _annotated; /** * Get method for accessing property value used to access property * (of Collection or Map type) to modify. */ protected final Method _getter; public SetterlessProperty(BeanPropertyDefinition propDef, JavaType type, TypeDeserializer typeDeser, Annotations contextAnnotations, AnnotatedMethod method) { super(propDef, type, typeDeser, contextAnnotations); _annotated = method; _getter = method.getAnnotated(); } protected SetterlessProperty(SetterlessProperty src, JsonDeserializer<?> deser) { super(src, deser); _annotated = src._annotated; _getter = src._getter; } protected SetterlessProperty(SetterlessProperty src, PropertyName newName) { super(src, newName); _annotated = src._annotated; _getter = src._getter; } @Override public SetterlessProperty withName(PropertyName newName) { return new SetterlessProperty(this, newName); } @Override public SetterlessProperty withValueDeserializer(JsonDeserializer<?> deser) { return new SetterlessProperty(this, deser); } /* /********************************************************** /* BeanProperty impl /********************************************************** */ @Override public <

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS>A extends Annotation> A getAnnotation(Class<A> acls) { return _annotated.getAnnotation(acls); } @Override public AnnotatedMember getMember() { return _annotated; } /* /********************************************************** /* Overridden methods /********************************************************** */ @Override public final void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { JsonToken t = p.getCurrentToken(); if (t == JsonToken.VALUE_NULL) { /* Hmmh. Is this a problem? We won't be setting anything, so it's * equivalent of empty Collection/Map in this case */ return; } // For [#501] fix we need to implement this but: if (_valueTypeDeserializer != null) { throw JsonMappingException.from(p, "Problem deserializing 'setterless' property (\""+getName()+"\"): no way to handle typed deser with setterless yet"); // return _valueDeserializer.deserializeWithType(jp, ctxt, _valueTypeDeserializer); } // Ok: then, need to fetch Collection/Map to modify: Object toModify; try { toModify = _getter.invoke(instance); } catch (Exception e) { _throwAsIOE(p, e); return; // never gets here } /* Note: null won't work, since we can't then inject anything * in. At least that's not good in common case. However, * theoretically the case where we get JSON null might * be compatible. If so, implementation could be changed. */ if (toModify == null) { throw JsonMappingException.from(p, "Problem deserializing 'setterless' property '"+getName()+"': get method returned null"); } _valueDeserializer.deserialize(p, ctxt, toModify); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeAndSet(p, ctxt, instance); return instance; } @Override public final void set(Object instance, Object value) throws IOException { throw new UnsupportedOperationException("Should never call 'set' on setterless property"); } @Override public Object setAndReturn(Object instance, Object value) throws

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS>.class); _acceptInt = (cls == Integer.TYPE) || cls.isAssignableFrom(Integer.class); _acceptDouble = (cls == Double.TYPE) || cls.isAssignableFrom(Double.class); } /** * Factory method used when constructing instances for non-POJO types, like * {@link java.util.Map}s. * * @since 2.3 */ public static AbstractDeserializer constructForNonPOJO(BeanDescription beanDesc) { return new AbstractDeserializer(beanDesc); } /* /********************************************************** /* Public accessors /********************************************************** */ @Override public Class<?> handledType() { return _baseType.getRawClass(); } @Override public boolean isCachable() { return true; } /** * Overridden to return true for those instances that are * handling value for which Object Identity handling is enabled * (either via value type or referring property). */ @Override public ObjectIdReader getObjectIdReader() { return _objectIdReader; } /** * Method called by <code>BeanDeserializer</code> to resolve back reference * part of managed references. */ @Override public SettableBeanProperty findBackReference(String logicalName) { return (_backRefProperties == null) ? null : _backRefProperties.get(logicalName); } /* /********************************************************** /* Deserializer implementation /********************************************************** */ @Override public Object deserializeWithType(JsonParser p, DeserializationContext ctxt, TypeDeserializer typeDeserializer) throws IOException { // Hmmh. One tricky question; for scalar, is it an Object Id, or "Natural" type? // for now, prefer Object Id: if (_objectIdReader != null) { JsonToken t = p.getCurrentToken(); if (t != null) { // Most commonly, a scalar (int id, uuid String, ...) if (t.isScalarValue()) { return _deserializeFromObjectId(p, ctxt); } // but, with 2.5+, a simple Object-wrapped value also legal: if (t == JsonToken.START_OBJECT) { t = p.nextToken(); } if ((t == JsonToken.FIELD_NAME) && _objectIdReader.maySerializeAsObject() && _

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS> newName); _delegate = src._delegate.withName(newName); _creator = src._creator; } @Override public InnerClassProperty withName(PropertyName newName) { return new InnerClassProperty(this, newName); } @Override public InnerClassProperty withValueDeserializer(JsonDeserializer<?> deser) { return new InnerClassProperty(this, deser); } // // // BeanProperty impl @Override public <A extends Annotation> A getAnnotation(Class<A> acls) { return _delegate.getAnnotation(acls); } @Override public AnnotatedMember getMember() { return _delegate.getMember(); } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser jp, DeserializationContext ctxt, Object bean) throws IOException { JsonToken t = jp.getCurrentToken(); Object value; if (t == JsonToken.VALUE_NULL) { value = _valueDeserializer.getNullValue(ctxt); } else if (_valueTypeDeserializer != null) { value = _valueDeserializer.deserializeWithType(jp, ctxt, _valueTypeDeserializer); } else { // the usual case try { value = _creator.newInstance(bean); } catch (Exception e) { ClassUtil.unwrapAndThrowAsIAE(e, "Failed to instantiate class "+_creator.getDeclaringClass().getName()+", problem: "+e.getMessage()); value = null; } _valueDeserializer.deserialize(jp, ctxt, value); } set(bean, value); } @Override public Object deserializeSetAndReturn(JsonParser jp, DeserializationContext ctxt, Object instance) throws IOException { return setAndReturn(instance, deserialize(jp, ctxt)); } @Override public final void set(Object instance, Object value) throws IOException { _delegate.set(instance, value); } @Override public Object setAndReturn(Object instance, Object value) throws IOException { return _delegate.setAndReturn(instance, value); } /* /********************************************************** /* JDK serialization handling /********************************************************** */ // When reading things back, Object readResolve() { return new InnerClassProperty(this, _annotated); }

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS>package com.fasterxml.jackson.databind.deser.std; import java.io.IOException; import com.fasterxml.jackson.core.*; import com.fasterxml.jackson.databind.DeserializationContext; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.annotation.JacksonStdImpl; import com.fasterxml.jackson.databind.jsontype.TypeDeserializer; @JacksonStdImpl public final class StringDeserializer extends StdScalarDeserializer<String> { private static final long serialVersionUID = 1L; /** * @since 2.2 */ public final static StringDeserializer instance = new StringDeserializer(); public StringDeserializer() { super(String.class); } // since 2.6, slightly faster lookups for this very common type @Override public boolean isCachable() { return true; } @Override public String deserialize(JsonParser p, DeserializationContext ctxt) throws IOException { if (p.hasToken(JsonToken.VALUE_STRING)) { return p.getText(); } JsonToken t = p.getCurrentToken(); // [databind#381] if ((t == JsonToken.START_ARRAY) && ctxt.isEnabled(DeserializationFeature.UNWRAP_SINGLE_VALUE_ARRAYS)) { p.nextToken(); final String parsed = _parseString(p, ctxt); if (p.nextToken() != JsonToken.END_ARRAY) { throw ctxt.wrongTokenException(p, JsonToken.END_ARRAY, "Attempted to unwrap single value array for single 'String' value but there was more than a single value in the array"); } return parsed; } // need to gracefully handle byte[] data, as base64 if (t == JsonToken.VALUE_EMBEDDED_OBJECT) { Object ob = p.getEmbeddedObject(); if (ob == null) { return null; } if (ob instanceof byte[]) { return ctxt.getBase64Variant().encode((byte[]) ob, false); } // otherwise, try conversion using toString()... return ob.toString(); } // allow coercions for other scalar types String text = p.getValueAsString(); if (text != null) { return text;

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS>ContextualValueDeserializer(contentType, property); } else { // if directly assigned, probably not yet contextual, so: vd = ctxt.handleSecondaryContextualization(vd, property, contentType); } TypeDeserializer vtd = _valueTypeDeserializer; if (vtd != null) { vtd = vtd.forProperty(property); } return withResolved(kd, vtd, vd); } /* /********************************************************** /* ContainerDeserializerBase API /********************************************************** */ @Override public JavaType getContentType() { return _type.containedType(1); } @Override public JsonDeserializer<Object> getContentDeserializer() { return _valueDeserializer; } /* /********************************************************** /* JsonDeserializer API /********************************************************** */ @Override public Map.Entry<Object,Object> deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException { // Ok: must point to START_OBJECT, FIELD_NAME or END_OBJECT JsonToken t = jp.getCurrentToken(); if (t != JsonToken.START_OBJECT && t != JsonToken.FIELD_NAME && t != JsonToken.END_OBJECT) { // [JACKSON-620] (empty) String may be ok however: // slightly redundant (since String was passed above), but return _deserializeFromEmpty(jp, ctxt); } if (t == JsonToken.START_OBJECT) { t = jp.nextToken(); } if (t != JsonToken.FIELD_NAME) { if (t == JsonToken.END_OBJECT) { throw ctxt.mappingException("Can not deserialize a Map.Entry out of empty JSON Object"); } throw ctxt.mappingException(handledType(), t); } final KeyDeserializer keyDes = _keyDeserializer; final JsonDeserializer<Object> valueDes = _valueDeserializer; final TypeDeserializer typeDeser = _valueTypeDeserializer; final String keyStr = jp.getCurrentName(); Object key = keyDes.deserializeKey(keyStr, ctxt); Object value = null; // And then the value... t = jp.nextToken(); try { // Note: must handle null explicitly here; value deserializers won't if (t == JsonToken.VALUE_NULL) { value = valueDes.get

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS>NullValue(ctxt); } else if (typeDeser == null) { value = valueDes.deserialize(jp, ctxt); } else { value = valueDes.deserializeWithType(jp, ctxt, typeDeser); } } catch (Exception e) { wrapAndThrow(e, Map.Entry.class, keyStr); } // Close, but also verify that we reached the END_OBJECT t = jp.nextToken(); if (t != JsonToken.END_OBJECT) { if (t == JsonToken.FIELD_NAME) { // most likely throw ctxt.mappingException("Problem binding JSON into Map.Entry: more than one entry in JSON (second field: '"+jp.getCurrentName()+"')"); } // how would this occur? throw ctxt.mappingException("Problem binding JSON into Map.Entry: unexpected content after JSON Object entry: "+t); } return new AbstractMap.SimpleEntry<Object,Object>(key, value); } @Override public Map.Entry<Object,Object> deserialize(JsonParser jp, DeserializationContext ctxt, Map.Entry<Object,Object> result) throws IOException { throw new IllegalStateException("Can not update Map.Entry values"); } @Override public Object deserializeWithType(JsonParser jp, DeserializationContext ctxt, TypeDeserializer typeDeserializer) throws IOException, JsonProcessingException { // In future could check current token... for now this should be enough: return typeDeserializer.deserializeTypedFromObject(jp, ctxt); } /* /********************************************************** /* Other public accessors /********************************************************** */ @Override public JavaType getValueType() { return _type; } }

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS>enumClass; _enumDeserializer = (JsonDeserializer<Enum<?>>) deser; _unwrapSingle = unwrapSingle; } public EnumSetDeserializer withDeserializer(JsonDeserializer<?> deser) { if (_enumDeserializer == deser) { return this; } return new EnumSetDeserializer(this, deser, _unwrapSingle); } public EnumSetDeserializer withResolved(JsonDeserializer<?> deser, Boolean unwrapSingle) { if ((_unwrapSingle == unwrapSingle) && (_enumDeserializer == deser)) { return this; } return new EnumSetDeserializer(this, deser, unwrapSingle); } /** * Because of costs associated with constructing Enum resolvers, * let's cache instances by default. */ @Override public boolean isCachable() { // One caveat: content deserializer should prevent caching if (_enumType.getValueHandler() != null) { return false; } return true; } @Override public JsonDeserializer<?> createContextual(DeserializationContext ctxt, BeanProperty property) throws JsonMappingException { Boolean unwrapSingle = findFormatFeature(ctxt, property, EnumSet.class, JsonFormat.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY); JsonDeserializer<?> deser = _enumDeserializer; if (deser == null) { deser = ctxt.findContextualValueDeserializer(_enumType, property); } else { // if directly assigned, probably not yet contextual, so: deser = ctxt.handleSecondaryContextualization(deser, property, _enumType); } return withResolved(deser, unwrapSingle); } /* /********************************************************** /* JsonDeserializer API /********************************************************** */ @SuppressWarnings("unchecked") @Override public EnumSet<?> deserialize(JsonParser p, DeserializationContext ctxt) throws IOException { // Ok: must point to START_ARRAY (or equivalent) if (!p.isExpectedStartArrayToken()) { return handleNonArray(p, ctxt); } EnumSet result = constructSet(); JsonToken t; try { while ((t = p.nextToken()) != JsonToken.END_ARRAY) { /* What to do with nulls? Fail or ignore? Fail, for now * (note: would fail if we passed it to EnumDeserializer, too, * but in general

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS> nulls should never be passed to non-container * deserializers) */ if (t == JsonToken.VALUE_NULL) { throw ctxt.mappingException(_enumClass); } Enum<?> value = _enumDeserializer.deserialize(p, ctxt); /* 24-Mar-2012, tatu: As per [JACKSON-810], may actually get nulls; * but EnumSets don't allow nulls so need to skip. */ if (value != null) { result.add(value); } } } catch (Exception e) { throw JsonMappingException.wrapWithPath(e, result, result.size()); } return result; } @Override public Object deserializeWithType(JsonParser p, DeserializationContext ctxt, TypeDeserializer typeDeserializer) throws IOException, JsonProcessingException { return typeDeserializer.deserializeTypedFromArray(p, ctxt); } @SuppressWarnings("unchecked") private EnumSet constructSet() { // superbly ugly... but apparently necessary return EnumSet.noneOf(_enumClass); } @SuppressWarnings("unchecked") protected EnumSet<?> handleNonArray(JsonParser p, DeserializationContext ctxt) throws IOException { boolean canWrap = (_unwrapSingle == Boolean.TRUE) || ((_unwrapSingle == null) && ctxt.isEnabled(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY)); if (!canWrap) { throw ctxt.mappingException(EnumSet.class); } EnumSet result = constructSet(); // First: since `null`s not allowed, slightly simpler... if (p.hasToken(JsonToken.VALUE_NULL)) { throw ctxt.mappingException(_enumClass); } try { Enum<?> value = _enumDeserializer.deserialize(p, ctxt); if (value != null) { result.add(value); } } catch (Exception e) { throw JsonMappingException.wrapWithPath(e, result, result.size()); } return result; } }

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS>package com.fasterxml.jackson.databind.node; import java.io.IOException; import java.util.Arrays; import com.fasterxml.jackson.core.*; import com.fasterxml.jackson.databind.SerializerProvider; /** * Value node that contains Base64 encoded binary value, which will be * output and stored as Json String value. */ public class BinaryNode extends ValueNode { final static BinaryNode EMPTY_BINARY_NODE = new BinaryNode(new byte[0]); protected final byte[] _data; public BinaryNode(byte[] data) { _data = data; } public BinaryNode(byte[] data, int offset, int length) { if (offset == 0 && length == data.length) { _data = data; } else { _data = new byte[length]; System.arraycopy(data, offset, _data, 0, length); } } public static BinaryNode valueOf(byte[] data) { if (data == null) { return null; } if (data.length == 0) { return EMPTY_BINARY_NODE; } return new BinaryNode(data); } public static BinaryNode valueOf(byte[] data, int offset, int length) { if (data == null) { return null; } if (length == 0) { return EMPTY_BINARY_NODE; } return new BinaryNode(data, offset, length); } @Override public JsonNodeType getNodeType() { return JsonNodeType.BINARY; } @Override public JsonToken asToken() { /* No distinct type; could use one for textual values, * but given that it's not in text form at this point, * embedded-object is closest */ return JsonToken.VALUE_EMBEDDED_OBJECT; } /** *<p> * Note: caller is not to modify returned array in any way, since * it is not a copy but reference to the underlying byte array. */ @Override public byte[] binaryValue() { return _data; } /** * Hmmh. This is not quite as efficient as using {@link #serialize}, * but will work correctly. */ @Override

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS>jackson.databind.deser.ContextualDeserializer}. * * @since 2.5 */ protected StdDeserializer(StdDeserializer<?> src) { _valueClass = src._valueClass; } /* /********************************************************** /* Accessors /********************************************************** */ @Override public Class<?> handledType() { return _valueClass; } /* /********************************************************** /* Extended API /********************************************************** */ /** * @deprecated Since 2.3 use {@link #handledType} instead */ @Deprecated public final Class<?> getValueClass() { return _valueClass; } /** * Exact structured type deserializer handles, if known. *<p> * Default implementation just returns null. */ public JavaType getValueType() { return null; } /** * Method that can be called to determine if given deserializer is the default * deserializer Jackson uses; as opposed to a custom deserializer installed by * a module or calling application. Determination is done using * {@link JacksonStdImpl} annotation on deserializer class. */ protected boolean isDefaultDeserializer(JsonDeserializer<?> deserializer) { return ClassUtil.isJacksonStdImpl(deserializer); } protected boolean isDefaultKeyDeserializer(KeyDeserializer keyDeser) { return ClassUtil.isJacksonStdImpl(keyDeser); } /* /********************************************************** /* Partial JsonDeserializer implementation /********************************************************** */ /** * Base implementation that does not assume specific type * inclusion mechanism. Sub-classes are expected to override * this method if they are to handle type information. */ @Override public Object deserializeWithType(JsonParser jp, DeserializationContext ctxt, TypeDeserializer typeDeserializer) throws IOException { return typeDeserializer.deserializeTypedFromAny(jp, ctxt); } /* /********************************************************** /* Helper methods for sub-classes, parsing: while mostly /* useful for numeric types, can be also useful for dealing /* with things serialized as numbers (such as Dates). /********************************************************** */ protected final boolean _parseBooleanPrimitive(JsonParser jp, DeserializationContext ctxt) throws IOException { JsonToken t = jp.getCurrentToken(); if (t == JsonToken.VALUE_TRUE) return true; if (t == JsonToken.VALUE_FALSE

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS>) return false; if (t == JsonToken.VALUE_NULL) return false; // [JACKSON-78]: should accept ints too, (0 == false, otherwise true) if (t == JsonToken.VALUE_NUMBER_INT) { // 11-Jan-2012, tatus: May be outside of int... if (jp.getNumberType() == NumberType.INT) { return (jp.getIntValue() != 0); } return _parseBooleanFromOther(jp, ctxt); } // And finally, let's allow Strings to be converted too if (t == JsonToken.VALUE_STRING) { String text = jp.getText().trim(); // [#422]: Allow aliases if ("true".equals(text) || "True".equals(text)) { return true; } if ("false".equals(text) || "False".equals(text) || text.length() == 0) { return false; } if (_hasTextualNull(text)) { return false; } throw ctxt.weirdStringException(text, _valueClass, "only \"true\" or \"false\" recognized"); } // [databind#381] if (t == JsonToken.START_ARRAY && ctxt.isEnabled(DeserializationFeature.UNWRAP_SINGLE_VALUE_ARRAYS)) { jp.nextToken(); final boolean parsed = _parseBooleanPrimitive(jp, ctxt); t = jp.nextToken(); if (t != JsonToken.END_ARRAY) { throw ctxt.wrongTokenException(jp, JsonToken.END_ARRAY, "Attempted to unwrap single value array for single 'boolean' value but there was more than a single value in the array"); } return parsed; } // Otherwise, no can do: throw ctxt.mappingException(_valueClass, t); } protected final Boolean _parseBoolean(JsonParser p, DeserializationContext ctxt) throws IOException { JsonToken t = p.getCurrentToken(); if (t == JsonToken.VALUE_TRUE) { return Boolean.TRUE; } if (t == JsonToken.VALUE_FALSE) { return Boolean.FALSE; } // [JACKSON-78]: should accept ints

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS> too, (0 == false, otherwise true) if (t == JsonToken.VALUE_NUMBER_INT) { // 11-Jan-2012, tatus: May be outside of int... if (p.getNumberType() == NumberType.INT) { return (p.getIntValue() == 0) ? Boolean.FALSE : Boolean.TRUE; } return Boolean.valueOf(_parseBooleanFromOther(p, ctxt)); } if (t == JsonToken.VALUE_NULL) { return (Boolean) getNullValue(ctxt); } // And finally, let's allow Strings to be converted too if (t == JsonToken.VALUE_STRING) { String text = p.getText().trim(); // [#422]: Allow aliases if ("true".equals(text) || "True".equals(text)) { return Boolean.TRUE; } if ("false".equals(text) || "False".equals(text)) { return Boolean.FALSE; } if (text.length() == 0) { return (Boolean) getEmptyValue(ctxt); } if (_hasTextualNull(text)) { return (Boolean) getNullValue(ctxt); } throw ctxt.weirdStringException(text, _valueClass, "only \"true\" or \"false\" recognized"); } // Issue#381 if (t == JsonToken.START_ARRAY && ctxt.isEnabled(DeserializationFeature.UNWRAP_SINGLE_VALUE_ARRAYS)) { p.nextToken(); final Boolean parsed = _parseBoolean(p, ctxt); t = p.nextToken(); if (t != JsonToken.END_ARRAY) { throw ctxt.wrongTokenException(p, JsonToken.END_ARRAY, "Attempted to unwrap single value array for single 'Boolean' value but there was more than a single value in the array"); } return parsed; } // Otherwise, no can do: throw ctxt.mappingException(_valueClass, t); } protected final boolean _parseBooleanFromOther(JsonParser p, DeserializationContext ctxt) throws IOException { if (p.getNumberType() == NumberType.LONG) { return (p.getLongValue() == 0L) ? Boolean.FALSE : Boolean.

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS>TRUE; } // no really good logic; let's actually resort to textual comparison String str = p.getText(); if ("0.0".equals(str) || "0".equals(str)) { return Boolean.FALSE; } return Boolean.TRUE; } protected Byte _parseByte(JsonParser p, DeserializationContext ctxt) throws IOException { JsonToken t = p.getCurrentToken(); if (t == JsonToken.VALUE_NUMBER_INT) { return p.getByteValue(); } if (t == JsonToken.VALUE_STRING) { // let's do implicit re-parse String text = p.getText().trim(); if (_hasTextualNull(text)) { return (Byte) getNullValue(ctxt); } int value; try { int len = text.length(); if (len == 0) { return (Byte) getEmptyValue(ctxt); } value = NumberInput.parseInt(text); } catch (IllegalArgumentException iae) { throw ctxt.weirdStringException(text, _valueClass, "not a valid Byte value"); } // So far so good: but does it fit? // as per [JACKSON-804], allow range up to 255, inclusive if (value < Byte.MIN_VALUE || value > 255) { throw ctxt.weirdStringException(text, _valueClass, "overflow, value can not be represented as 8-bit value"); } return Byte.valueOf((byte) value); } if (t == JsonToken.VALUE_NUMBER_FLOAT) { if (!ctxt.isEnabled(DeserializationFeature.ACCEPT_FLOAT_AS_INT)) { _failDoubleToIntCoercion(p, ctxt, "Byte"); } return p.getByteValue(); } if (t == JsonToken.VALUE_NULL) { return (Byte) getNullValue(ctxt); } // Issue#381 if (t == JsonToken.START_ARRAY && ctxt.isEnabled(DeserializationFeature.UNWRAP_SINGLE_VALUE_ARRAYS)) { p.nextToken(); final Byte parsed = _parseByte(p, ctxt); t = p.nextToken(); if (t != JsonToken.END_

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS>ARRAY) { throw ctxt.wrongTokenException(p, JsonToken.END_ARRAY, "Attempted to unwrap single value array for single 'Byte' value but there was more than a single value in the array"); } return parsed; } throw ctxt.mappingException(_valueClass, t); } protected Short _parseShort(JsonParser p, DeserializationContext ctxt) throws IOException { JsonToken t = p.getCurrentToken(); if (t == JsonToken.VALUE_NUMBER_INT) { return p.getShortValue(); } if (t == JsonToken.VALUE_STRING) { // let's do implicit re-parse String text = p.getText().trim(); int value; try { int len = text.length(); if (len == 0) { return (Short) getEmptyValue(ctxt); } if (_hasTextualNull(text)) { return (Short) getNullValue(ctxt); } value = NumberInput.parseInt(text); } catch (IllegalArgumentException iae) { throw ctxt.weirdStringException(text, _valueClass, "not a valid Short value"); } // So far so good: but does it fit? if (value < Short.MIN_VALUE || value > Short.MAX_VALUE) { throw ctxt.weirdStringException(text, _valueClass, "overflow, value can not be represented as 16-bit value"); } return Short.valueOf((short) value); } if (t == JsonToken.VALUE_NUMBER_FLOAT) { if (!ctxt.isEnabled(DeserializationFeature.ACCEPT_FLOAT_AS_INT)) { _failDoubleToIntCoercion(p, ctxt, "Short"); } return p.getShortValue(); } if (t == JsonToken.VALUE_NULL) { return (Short) getNullValue(ctxt); } // Issue#381 if (t == JsonToken.START_ARRAY && ctxt.isEnabled(DeserializationFeature.UNWRAP_SINGLE_VALUE_ARRAYS)) { p.nextToken(); final Short parsed = _parseShort(p, ctxt); t = p.nextToken(); if (t != JsonToken.END_ARRAY) { throw ctxt.wrongTokenException(p,

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS> JsonToken.END_ARRAY, "Attempted to unwrap single value array for single 'Short' value but there was more than a single value in the array"); } return parsed; } throw ctxt.mappingException(_valueClass, t); } protected final short _parseShortPrimitive(JsonParser jp, DeserializationContext ctxt) throws IOException { int value = _parseIntPrimitive(jp, ctxt); // So far so good: but does it fit? if (value < Short.MIN_VALUE || value > Short.MAX_VALUE) { throw ctxt.weirdStringException(String.valueOf(value), _valueClass, "overflow, value can not be represented as 16-bit value"); } return (short) value; } protected final int _parseIntPrimitive(JsonParser p, DeserializationContext ctxt) throws IOException { if (p.hasToken(JsonToken.VALUE_NUMBER_INT)) { return p.getIntValue(); } JsonToken t = p.getCurrentToken(); if (t == JsonToken.VALUE_STRING) { // let's do implicit re-parse String text = p.getText().trim(); if (_hasTextualNull(text)) { return 0; } try { int len = text.length(); if (len > 9) { long l = Long.parseLong(text); if (l < Integer.MIN_VALUE || l > Integer.MAX_VALUE) { throw ctxt.weirdStringException(text, _valueClass, "Overflow: numeric value ("+text+") out of range of int ("+Integer.MIN_VALUE+" - "+Integer.MAX_VALUE+")"); } return (int) l; } if (len == 0) { return 0; } return NumberInput.parseInt(text); } catch (IllegalArgumentException iae) { throw ctxt.weirdStringException(text, _valueClass, "not a valid int value"); } } if (t == JsonToken.VALUE_NUMBER_FLOAT) { if (!ctxt.isEnabled(DeserializationFeature.ACCEPT_FLOAT_AS_INT)) { _failDoubleToIntCoercion(p, ctxt, "int"); } return p.getValueAsInt();

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS> } if (t == JsonToken.VALUE_NULL) { return 0; } if (t == JsonToken.START_ARRAY && ctxt.isEnabled(DeserializationFeature.UNWRAP_SINGLE_VALUE_ARRAYS)) { p.nextToken(); final int parsed = _parseIntPrimitive(p, ctxt); t = p.nextToken(); if (t != JsonToken.END_ARRAY) { throw ctxt.wrongTokenException(p, JsonToken.END_ARRAY, "Attempted to unwrap single value array for single 'int' value but there was more than a single value in the array"); } return parsed; } // Otherwise, no can do: throw ctxt.mappingException(_valueClass, t); } protected final Integer _parseInteger(JsonParser p, DeserializationContext ctxt) throws IOException { switch (p.getCurrentTokenId()) { // NOTE: caller assumed to usually check VALUE_NUMBER_INT in fast path case JsonTokenId.ID_NUMBER_INT: return Integer.valueOf(p.getIntValue()); case JsonTokenId.ID_NUMBER_FLOAT: // coercing may work too if (!ctxt.isEnabled(DeserializationFeature.ACCEPT_FLOAT_AS_INT)) { _failDoubleToIntCoercion(p, ctxt, "Integer"); } return Integer.valueOf(p.getValueAsInt()); case JsonTokenId.ID_STRING: // let's do implicit re-parse String text = p.getText().trim(); try { int len = text.length(); if (_hasTextualNull(text)) { return (Integer) getNullValue(ctxt); } if (len > 9) { long l = Long.parseLong(text); if (l < Integer.MIN_VALUE || l > Integer.MAX_VALUE) { throw ctxt.weirdStringException(text, _valueClass, "Overflow: numeric value ("+text+") out of range of Integer ("+Integer.MIN_VALUE+" - "+Integer.MAX_VALUE+")"); } return Integer.valueOf((int) l); } if (len == 0) { return (Integer) getEmptyValue(ctxt); } return Integer.valueOf(NumberInput.parseInt(text)); } catch (IllegalArgumentException iae

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS>) { throw ctxt.weirdStringException(text, _valueClass, "not a valid Integer value"); } case JsonTokenId.ID_NULL: return (Integer) getNullValue(ctxt); case JsonTokenId.ID_START_ARRAY: if (ctxt.isEnabled(DeserializationFeature.UNWRAP_SINGLE_VALUE_ARRAYS)) { p.nextToken(); final Integer parsed = _parseInteger(p, ctxt); if (p.nextToken() != JsonToken.END_ARRAY) { throw ctxt.wrongTokenException(p, JsonToken.END_ARRAY, "Attempted to unwrap single value array for single 'Integer' value but there was more than a single value in the array"); } return parsed; } break; } // Otherwise, no can do: throw ctxt.mappingException(_valueClass, p.getCurrentToken()); } protected final Long _parseLong(JsonParser p, DeserializationContext ctxt) throws IOException { switch (p.getCurrentTokenId()) { // NOTE: caller assumed to usually check VALUE_NUMBER_INT in fast path case JsonTokenId.ID_NUMBER_INT: return p.getLongValue(); case JsonTokenId.ID_NUMBER_FLOAT: if (!ctxt.isEnabled(DeserializationFeature.ACCEPT_FLOAT_AS_INT)) { _failDoubleToIntCoercion(p, ctxt, "Long"); } return p.getValueAsLong(); case JsonTokenId.ID_STRING: // let's allow Strings to be converted too // !!! 05-Jan-2009, tatu: Should we try to limit value space, JDK is too lenient? String text = p.getText().trim(); if (text.length() == 0) { return (Long) getEmptyValue(ctxt); } if (_hasTextualNull(text)) { return (Long) getNullValue(ctxt); } try { return Long.valueOf(NumberInput.parseLong(text)); } catch (IllegalArgumentException iae) { } throw ctxt.weirdStringException(text, _valueClass, "not a valid Long value"); case JsonTokenId.ID_NULL: return (Long) getNullValue(ctxt); case JsonTokenId.ID_START_ARRAY

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS>: if (ctxt.isEnabled(DeserializationFeature.UNWRAP_SINGLE_VALUE_ARRAYS)) { p.nextToken(); final Long parsed = _parseLong(p, ctxt); JsonToken t = p.nextToken(); if (t != JsonToken.END_ARRAY) { throw ctxt.wrongTokenException(p, JsonToken.END_ARRAY, "Attempted to unwrap single value array for single 'Long' value but there was more than a single value in the array"); } return parsed; } break; } // Otherwise, no can do: throw ctxt.mappingException(_valueClass, p.getCurrentToken()); } protected final long _parseLongPrimitive(JsonParser p, DeserializationContext ctxt) throws IOException { switch (p.getCurrentTokenId()) { case JsonTokenId.ID_NUMBER_INT: return p.getLongValue(); case JsonTokenId.ID_NUMBER_FLOAT: if (!ctxt.isEnabled(DeserializationFeature.ACCEPT_FLOAT_AS_INT)) { _failDoubleToIntCoercion(p, ctxt, "long"); } return p.getValueAsLong(); case JsonTokenId.ID_STRING: String text = p.getText().trim(); if (text.length() == 0 || _hasTextualNull(text)) { return 0L; } try { return NumberInput.parseLong(text); } catch (IllegalArgumentException iae) { } throw ctxt.weirdStringException(text, _valueClass, "not a valid long value"); case JsonTokenId.ID_NULL: return 0L; case JsonTokenId.ID_START_ARRAY: if (ctxt.isEnabled(DeserializationFeature.UNWRAP_SINGLE_VALUE_ARRAYS)) { p.nextToken(); final long parsed = _parseLongPrimitive(p, ctxt); JsonToken t = p.nextToken(); if (t != JsonToken.END_ARRAY) { throw ctxt.wrongTokenException(p, JsonToken.END_ARRAY, "Attempted to unwrap single value array for single 'long' value but there was more than a single value in the array"); } return parsed; } break; } throw ctxt.mappingException(_valueClass, p.getCurrentToken());

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS> } protected final Float _parseFloat(JsonParser jp, DeserializationContext ctxt) throws IOException { // We accept couple of different types; obvious ones first: JsonToken t = jp.getCurrentToken(); if (t == JsonToken.VALUE_NUMBER_INT || t == JsonToken.VALUE_NUMBER_FLOAT) { // coercing should work too return jp.getFloatValue(); } // And finally, let's allow Strings to be converted too if (t == JsonToken.VALUE_STRING) { String text = jp.getText().trim(); if (text.length() == 0) { return (Float) getEmptyValue(ctxt); } if (_hasTextualNull(text)) { return (Float) getNullValue(ctxt); } switch (text.charAt(0)) { case 'I': if (_isPosInf(text)) { return Float.POSITIVE_INFINITY; } break; case 'N': if (_isNaN(text)) { return Float.NaN; } break; case '-': if (_isNegInf(text)) { return Float.NEGATIVE_INFINITY; } break; } try { return Float.parseFloat(text); } catch (IllegalArgumentException iae) { } throw ctxt.weirdStringException(text, _valueClass, "not a valid Float value"); } if (t == JsonToken.VALUE_NULL) { return (Float) getNullValue(ctxt); } // Issue#381 if (t == JsonToken.START_ARRAY && ctxt.isEnabled(DeserializationFeature.UNWRAP_SINGLE_VALUE_ARRAYS)) { jp.nextToken(); final Float parsed = _parseFloat(jp, ctxt); t = jp.nextToken(); if (t != JsonToken.END_ARRAY) { throw ctxt.wrongTokenException(jp, JsonToken.END_ARRAY, "Attempted to unwrap single value array for single 'Byte' value but there was more than a single value in the array"); } return parsed; } // Otherwise, no can do: throw ctxt.mappingException(_valueClass, t); } protected final float _parseFloatPrimitive(JsonParser jp, DeserializationContext ctxt) throws IOException { JsonToken t

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS> = jp.getCurrentToken(); if (t == JsonToken.VALUE_NUMBER_INT || t == JsonToken.VALUE_NUMBER_FLOAT) { // coercing should work too return jp.getFloatValue(); } if (t == JsonToken.VALUE_STRING) { String text = jp.getText().trim(); if (text.length() == 0 || _hasTextualNull(text)) { return 0.0f; } switch (text.charAt(0)) { case 'I': if (_isPosInf(text)) { return Float.POSITIVE_INFINITY; } break; case 'N': if (_isNaN(text)) { return Float.NaN; } break; case '-': if (_isNegInf(text)) { return Float.NEGATIVE_INFINITY; } break; } try { return Float.parseFloat(text); } catch (IllegalArgumentException iae) { } throw ctxt.weirdStringException(text, _valueClass, "not a valid float value"); } if (t == JsonToken.VALUE_NULL) { return 0.0f; } // Issue#381 if (t == JsonToken.START_ARRAY && ctxt.isEnabled(DeserializationFeature.UNWRAP_SINGLE_VALUE_ARRAYS)) { jp.nextToken(); final float parsed = _parseFloatPrimitive(jp, ctxt); t = jp.nextToken(); if (t != JsonToken.END_ARRAY) { throw ctxt.wrongTokenException(jp, JsonToken.END_ARRAY, "Attempted to unwrap single value array for single 'float' value but there was more than a single value in the array"); } return parsed; } // Otherwise, no can do: throw ctxt.mappingException(_valueClass, t); } protected final Double _parseDouble(JsonParser jp, DeserializationContext ctxt) throws IOException { JsonToken t = jp.getCurrentToken(); if (t == JsonToken.VALUE_NUMBER_INT || t == JsonToken.VALUE_NUMBER_FLOAT) { // coercing should work too return jp.getDoubleValue(); } if (t == JsonToken.VALUE_STRING) { String text = jp.getText().trim(); if (text

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS>.length() == 0) { return (Double) getEmptyValue(ctxt); } if (_hasTextualNull(text)) { return (Double) getNullValue(ctxt); } switch (text.charAt(0)) { case 'I': if (_isPosInf(text)) { return Double.POSITIVE_INFINITY; } break; case 'N': if (_isNaN(text)) { return Double.NaN; } break; case '-': if (_isNegInf(text)) { return Double.NEGATIVE_INFINITY; } break; } try { return parseDouble(text); } catch (IllegalArgumentException iae) { } throw ctxt.weirdStringException(text, _valueClass, "not a valid Double value"); } if (t == JsonToken.VALUE_NULL) { return (Double) getNullValue(ctxt); } if (t == JsonToken.START_ARRAY && ctxt.isEnabled(DeserializationFeature.UNWRAP_SINGLE_VALUE_ARRAYS)) { jp.nextToken(); final Double parsed = _parseDouble(jp, ctxt); t = jp.nextToken(); if (t != JsonToken.END_ARRAY) { throw ctxt.wrongTokenException(jp, JsonToken.END_ARRAY, "Attempted to unwrap single value array for single 'Double' value but there was more than a single value in the array"); } return parsed; } // Otherwise, no can do: throw ctxt.mappingException(_valueClass, t); } protected final double _parseDoublePrimitive(JsonParser jp, DeserializationContext ctxt) throws IOException { // We accept couple of different types; obvious ones first: JsonToken t = jp.getCurrentToken(); if (t == JsonToken.VALUE_NUMBER_INT || t == JsonToken.VALUE_NUMBER_FLOAT) { // coercing should work too return jp.getDoubleValue(); } // And finally, let's allow Strings to be converted too if (t == JsonToken.VALUE_STRING) { String text = jp.getText().trim(); if (text.length() == 0 || _hasTextualNull(text)) { return 0.0; } switch (text.charAt(0)) {

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS> case 'I': if (_isPosInf(text)) { return Double.POSITIVE_INFINITY; } break; case 'N': if (_isNaN(text)) { return Double.NaN; } break; case '-': if (_isNegInf(text)) { return Double.NEGATIVE_INFINITY; } break; } try { return parseDouble(text); } catch (IllegalArgumentException iae) { } throw ctxt.weirdStringException(text, _valueClass, "not a valid double value"); } if (t == JsonToken.VALUE_NULL) { return 0.0; } // Issue#381 if (t == JsonToken.START_ARRAY && ctxt.isEnabled(DeserializationFeature.UNWRAP_SINGLE_VALUE_ARRAYS)) { jp.nextToken(); final double parsed = _parseDoublePrimitive(jp, ctxt); t = jp.nextToken(); if (t != JsonToken.END_ARRAY) { throw ctxt.wrongTokenException(jp, JsonToken.END_ARRAY, "Attempted to unwrap single value array for single 'Byte' value but there was more than a single value in the array"); } return parsed; } // Otherwise, no can do: throw ctxt.mappingException(_valueClass, t); } protected java.util.Date _parseDate(JsonParser jp, DeserializationContext ctxt) throws IOException { JsonToken t = jp.getCurrentToken(); if (t == JsonToken.VALUE_NUMBER_INT) { return new java.util.Date(jp.getLongValue()); } if (t == JsonToken.VALUE_NULL) { return (java.util.Date) getNullValue(ctxt); } if (t == JsonToken.VALUE_STRING) { String value = null; try { // As per [JACKSON-203], take empty Strings to mean value = jp.getText().trim(); if (value.length() == 0) { return (Date) getEmptyValue(ctxt); } if (_hasTextualNull(value)) { return (java.util.Date) getNullValue(ctxt); } return ctxt.parseDate(value); } catch (IllegalArgumentException iae)

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS> { throw ctxt.weirdStringException(value, _valueClass, "not a valid representation (error: "+iae.getMessage()+")"); } } // Issue#381 if (t == JsonToken.START_ARRAY && ctxt.isEnabled(DeserializationFeature.UNWRAP_SINGLE_VALUE_ARRAYS)) { jp.nextToken(); final Date parsed = _parseDate(jp, ctxt); t = jp.nextToken(); if (t != JsonToken.END_ARRAY) { throw ctxt.wrongTokenException(jp, JsonToken.END_ARRAY, "Attempted to unwrap single value array for single 'java.util.Date' value but there was more than a single value in the array"); } return parsed; } throw ctxt.mappingException(_valueClass, t); } /** * Helper method for encapsulating calls to low-level double value parsing; single place * just because we need a work-around that must be applied to all calls. */ protected final static double parseDouble(String numStr) throws NumberFormatException { // avoid some nasty float representations... but should it be MIN_NORMAL or MIN_VALUE? if (NumberInput.NASTY_SMALL_DOUBLE.equals(numStr)) { return Double.MIN_NORMAL; // since 2.7; was MIN_VALUE prior } return Double.parseDouble(numStr); } /** * Helper method used for accessing String value, if possible, doing * necessary conversion or throwing exception as necessary. * * @since 2.1 */ protected final String _parseString(JsonParser p, DeserializationContext ctxt) throws IOException { JsonToken t = p.getCurrentToken(); if (t == JsonToken.VALUE_STRING) { return p.getText(); } // [databind#381] if (t == JsonToken.START_ARRAY && ctxt.isEnabled(DeserializationFeature.UNWRAP_SINGLE_VALUE_ARRAYS)) { p.nextToken(); final String parsed = _parseString(p, ctxt); if (p.nextToken() != JsonToken.END_ARRAY) { throw ctxt.wrongTokenException(p, JsonToken.END_ARRAY, "Attempted to unwrap single value array for single 'String' value but

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS> there was more than a single value in the array"); } return parsed; } String value = p.getValueAsString(); if (value != null) { return value; } throw ctxt.mappingException(String.class, p.getCurrentToken()); } /** * Helper method that may be used to support fallback for Empty String / Empty Array * non-standard representations; usually for things serialized as JSON Objects. * * @since 2.5 */ protected T _deserializeFromEmpty(JsonParser jp, DeserializationContext ctxt) throws IOException { JsonToken t = jp.getCurrentToken(); if (t == JsonToken.START_ARRAY) { if (ctxt.isEnabled(DeserializationFeature.ACCEPT_EMPTY_ARRAY_AS_NULL_OBJECT)) { t = jp.nextToken(); if (t == JsonToken.END_ARRAY) { return null; } throw ctxt.mappingException(handledType(), JsonToken.START_ARRAY); } } else if (t == JsonToken.VALUE_STRING) { if (ctxt.isEnabled(DeserializationFeature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT)) { String str = jp.getText().trim(); if (str.isEmpty()) { return null; } } } throw ctxt.mappingException(handledType()); } /** * Helper method called to determine if we are seeing String value of * "null", and, further, that it should be coerced to null just like * null token. * * @since 2.3 */ protected boolean _hasTextualNull(String value) { return "null".equals(value); } protected final boolean _isNegInf(String text) { return "-Infinity".equals(text) || "-INF".equals(text); } protected final boolean _isPosInf(String text) { return "Infinity".equals(text) || "INF".equals(text); } protected final boolean _isNaN(String text) { return "NaN".equals(text); } /* /**************************************************** /* Helper methods for sub-classes, coercions /**************************************************** */ /** * Helper method called in case where an integral number is encountered, but * config settings suggest that a coerc

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS> deser = ctxt.findContextualValueDeserializer(type, property); } else { // if directly assigned, probably not yet contextual, so: deser = ctxt.handleSecondaryContextualization(deser, property, type); } // One more thing: allow unwrapping? Boolean unwrapSingle = findFormatFeature(ctxt, property, String[].class, JsonFormat.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY); // Ok ok: if all we got is the default String deserializer, can just forget about it if ((deser != null) && isDefaultDeserializer(deser)) { deser = null; } if ((_elementDeserializer == deser) && (_unwrapSingle == unwrapSingle)) { return this; } return new StringArrayDeserializer(deser, unwrapSingle); } @Override public String[] deserialize(JsonParser p, DeserializationContext ctxt) throws IOException { // Ok: must point to START_ARRAY (or equivalent) if (!p.isExpectedStartArrayToken()) { return handleNonArray(p, ctxt); } if (_elementDeserializer != null) { return _deserializeCustom(p, ctxt); } final ObjectBuffer buffer = ctxt.leaseObjectBuffer(); Object[] chunk = buffer.resetAndStart(); int ix = 0; try { while (true) { String value = p.nextTextValue(); if (value == null) { JsonToken t = p.getCurrentToken(); if (t == JsonToken.END_ARRAY) { break; } if (t != JsonToken.VALUE_NULL) { value = _parseString(p, ctxt); } } if (ix >= chunk.length) { chunk = buffer.appendCompletedChunk(chunk); ix = 0; } chunk[ix++] = value; } } catch (Exception e) { throw JsonMappingException.wrapWithPath(e, chunk, buffer.bufferedSize() + ix); } String[] result = buffer.completeAndClearBuffer(chunk, ix, String.class); ctxt.returnObjectBuffer(buffer); return result; } /** * Offlined version used when we do not use the default deserialization method. */ protected final String[] _deserializeCustom(JsonParser

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS> p, DeserializationContext ctxt) throws IOException { final ObjectBuffer buffer = ctxt.leaseObjectBuffer(); Object[] chunk = buffer.resetAndStart(); final JsonDeserializer<String> deser = _elementDeserializer; int ix = 0; try { while (true) { /* 30-Dec-2014, tatu: This may look odd, but let's actually call method * that suggest we are expecting a String; this helps with some formats, * notably XML. Note, however, that while we can get String, we can't * assume that's what we use due to custom deserializer */ String value; if (p.nextTextValue() == null) { JsonToken t = p.getCurrentToken(); if (t == JsonToken.END_ARRAY) { break; } // Ok: no need to convert Strings, but must recognize nulls value = (t == JsonToken.VALUE_NULL) ? deser.getNullValue(ctxt) : deser.deserialize(p, ctxt); } else { value = deser.deserialize(p, ctxt); } if (ix >= chunk.length) { chunk = buffer.appendCompletedChunk(chunk); ix = 0; } chunk[ix++] = value; } } catch (Exception e) { // note: pass String.class, not String[].class, as we need element type for error info throw JsonMappingException.wrapWithPath(e, String.class, ix); } String[] result = buffer.completeAndClearBuffer(chunk, ix, String.class); ctxt.returnObjectBuffer(buffer); return result; } @Override public Object deserializeWithType(JsonParser p, DeserializationContext ctxt, TypeDeserializer typeDeserializer) throws IOException { return typeDeserializer.deserializeTypedFromArray(p, ctxt); } private final String[] handleNonArray(JsonParser p, DeserializationContext ctxt) throws IOException { // implicit arrays from single values? boolean canWrap = (_unwrapSingle == Boolean.TRUE) || ((_unwrapSingle == null) && ctxt.isEnabled(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY)); if (canWrap) { return new String[] { p.hasToken(JsonToken.VALUE

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS>_NULL) ? null : _parseString(p, ctxt) }; } else if (p.hasToken(JsonToken.VALUE_STRING) && ctxt.isEnabled(DeserializationFeature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT)) { String str = p.getText(); if (str.length() == 0) { return null; } } throw ctxt.mappingException(_valueClass); } }

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS>package com.fasterxml.jackson.databind.node; import java.io.IOException; import com.fasterxml.jackson.core.*; import com.fasterxml.jackson.databind.SerializerProvider; /** * This singleton value class is used to contain explicit JSON null * value. */ public final class NullNode extends ValueNode { // // Just need a fly-weight singleton public final static NullNode instance = new NullNode(); private NullNode() { } public static NullNode getInstance() { return instance; } @Override public JsonNodeType getNodeType() { return JsonNodeType.NULL; } @Override public JsonToken asToken() { return JsonToken.VALUE_NULL; } @Override public String asText(String defaultValue) { return defaultValue; } @Override public String asText() { return "null"; } // as with MissingNode, not considered number node; hence defaults are returned if provided /* public int asInt(int defaultValue); public long asLong(long defaultValue); public double asDouble(double defaultValue); public boolean asBoolean(boolean defaultValue); */ @Override public final void serialize(JsonGenerator g, SerializerProvider provider) throws IOException { provider.defaultSerializeNull(g); } @Override public boolean equals(Object o) { return (o == this); } @Override public int hashCode() { return JsonNodeType.NULL.ordinal(); } }

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS>Value(); if (value != null) { result.add(value); continue; } JsonToken t = p.getCurrentToken(); if (t == JsonToken.END_ARRAY) { break; } if (t != JsonToken.VALUE_NULL) { value = _parseString(p, ctxt); } result.add(value); } } catch (Exception e) { throw JsonMappingException.wrapWithPath(e, result, result.size()); } return result; } private Collection<String> deserializeUsingCustom(JsonParser p, DeserializationContext ctxt, Collection<String> result, final JsonDeserializer<String> deser) throws IOException { while (true) { /* 30-Dec-2014, tatu: This may look odd, but let's actually call method * that suggest we are expecting a String; this helps with some formats, * notably XML. Note, however, that while we can get String, we can't * assume that's what we use due to custom deserializer */ String value; if (p.nextTextValue() == null) { JsonToken t = p.getCurrentToken(); if (t == JsonToken.END_ARRAY) { break; } // Ok: no need to convert Strings, but must recognize nulls value = (t == JsonToken.VALUE_NULL) ? deser.getNullValue(ctxt) : deser.deserialize(p, ctxt); } else { value = deser.deserialize(p, ctxt); } result.add(value); } return result; } @Override public Object deserializeWithType(JsonParser p, DeserializationContext ctxt, TypeDeserializer typeDeserializer) throws IOException { // In future could check current token... for now this should be enough: return typeDeserializer.deserializeTypedFromArray(p, ctxt); } /** * Helper method called when current token is not START_ARRAY. Will either * throw an exception, or try to handle value as if member of implicit * array, depending on configuration. */ private final Collection<String> handleNonArray(JsonParser p, DeserializationContext ctxt, Collection<String> result) throws IOException { // implicit arrays from single values? boolean can

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS>Wrap = (_unwrapSingle == Boolean.TRUE) || ((_unwrapSingle == null) && ctxt.isEnabled(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY)); if (!canWrap) { throw ctxt.mappingException(_collectionType.getRawClass()); } // Strings are one of "native" (intrinsic) types, so there's never type deserializer involved JsonDeserializer<String> valueDes = _valueDeserializer; JsonToken t = p.getCurrentToken(); String value; if (t == JsonToken.VALUE_NULL) { value = (valueDes == null) ? null : valueDes.getNullValue(ctxt); } else { value = (valueDes == null) ? _parseString(p, ctxt) : valueDes.deserialize(p, ctxt); } result.add(value); return result; } }

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS>package com.fasterxml.jackson.databind.node; import java.io.IOException; import java.math.BigDecimal; import java.math.BigInteger; import com.fasterxml.jackson.core.*; import com.fasterxml.jackson.core.io.NumberOutput; import com.fasterxml.jackson.databind.SerializerProvider; /** * Numeric node that contains simple 32-bit integer values. */ public class IntNode extends NumericNode { // // // Let's cache small set of common value final static int MIN_CANONICAL = -1; final static int MAX_CANONICAL = 10; private final static IntNode[] CANONICALS; static { int count = MAX_CANONICAL - MIN_CANONICAL + 1; CANONICALS = new IntNode[count]; for (int i = 0; i < count; ++i) { CANONICALS[i] = new IntNode(MIN_CANONICAL + i); } } /** * Integer value this node contains */ protected final int _value; /* ************************************************ * Construction ************************************************ */ public IntNode(int v) { _value = v; } public static IntNode valueOf(int i) { if (i > MAX_CANONICAL || i < MIN_CANONICAL) return new IntNode(i); return CANONICALS[i - MIN_CANONICAL]; } /* /********************************************************** /* BaseJsonNode extended API /********************************************************** */ @Override public JsonToken asToken() { return JsonToken.VALUE_NUMBER_INT; } @Override public JsonParser.NumberType numberType() { return JsonParser.NumberType.INT; } /* /********************************************************** /* Overrridden JsonNode methods /********************************************************** */ @Override public boolean isIntegralNumber() { return true; } @Override public boolean isInt() { return true; } @Override public boolean canConvertToInt() { return true; } @Override public boolean canConvertToLong() { return true; } @Override public Number numberValue() { return Integer.valueOf(_value); } @Override public short shortValue() { return (short) _value

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS>package com.fasterxml.jackson.databind.node; import java.io.IOException; import java.math.BigDecimal; import java.math.BigInteger; import com.fasterxml.jackson.core.*; import com.fasterxml.jackson.core.io.NumberOutput; import com.fasterxml.jackson.databind.SerializerProvider; /** * Numeric node that contains simple 64-bit integer values. */ public class LongNode extends NumericNode { protected final long _value; /* ************************************************ * Construction ************************************************ */ public LongNode(long v) { _value = v; } public static LongNode valueOf(long l) { return new LongNode(l); } /* ************************************************ * Overrridden JsonNode methods ************************************************ */ @Override public JsonToken asToken() { return JsonToken.VALUE_NUMBER_INT; } @Override public JsonParser.NumberType numberType() { return JsonParser.NumberType.LONG; } @Override public boolean isIntegralNumber() { return true; } @Override public boolean isLong() { return true; } @Override public boolean canConvertToInt() { return (_value >= Integer.MIN_VALUE && _value <= Integer.MAX_VALUE); } @Override public boolean canConvertToLong() { return true; } @Override public Number numberValue() { return Long.valueOf(_value); } @Override public short shortValue() { return (short) _value; } @Override public int intValue() { return (int) _value; } @Override public long longValue() { return _value; } @Override public float floatValue() { return _value; } @Override public double doubleValue() { return _value; } @Override public BigDecimal decimalValue() { return BigDecimal.valueOf(_value); } @Override public BigInteger bigIntegerValue() { return BigInteger.valueOf(_value); } @Override public String asText() { return NumberOutput.toString(_value); } @Override public boolean asBoolean(boolean defaultValue) { return _value != 0; } @Override public final void serialize(JsonGenerator jg, SerializerProvider provider) throws IOException, JsonProcessingException {

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS>package com.fasterxml.jackson.databind.node; import java.io.IOException; import com.fasterxml.jackson.core.*; import com.fasterxml.jackson.core.io.CharTypes; import com.fasterxml.jackson.core.io.NumberInput; import com.fasterxml.jackson.core.util.ByteArrayBuilder; import com.fasterxml.jackson.databind.SerializerProvider; /** * Value node that contains a text value. */ public class TextNode extends ValueNode { final static TextNode EMPTY_STRING_NODE = new TextNode(""); protected final String _value; public TextNode(String v) { _value = v; } /** * Factory method that should be used to construct instances. * For some common cases, can reuse canonical instances: currently * this is the case for empty Strings, in future possible for * others as well. If null is passed, will return null. * * @return Resulting {@link TextNode} object, if <b>v</b> * is NOT null; null if it is. */ public static TextNode valueOf(String v) { if (v == null) { return null; } if (v.length() == 0) { return EMPTY_STRING_NODE; } return new TextNode(v); } @Override public JsonNodeType getNodeType() { return JsonNodeType.STRING; } @Override public JsonToken asToken() { return JsonToken.VALUE_STRING; } @Override public String textValue() { return _value; } /** * Method for accessing textual contents assuming they were * base64 encoded; if so, they are decoded and resulting binary * data is returned. */ public byte[] getBinaryValue(Base64Variant b64variant) throws IOException { @SuppressWarnings("resource") ByteArrayBuilder builder = new ByteArrayBuilder(100); final String str = _value; int ptr = 0; int len = str.length(); main_loop: while (ptr < len) { // first, we'll skip preceding white space, if any char ch; do { ch = str.charAt(ptr++); if (ptr >= len) { break

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS>package com.fasterxml.jackson.databind.node; import java.io.IOException; import java.math.BigDecimal; import java.math.BigInteger; import com.fasterxml.jackson.core.*; import com.fasterxml.jackson.core.io.NumberOutput; import com.fasterxml.jackson.databind.SerializerProvider; /** * Numeric node that contains simple 16-bit integer values. */ public class ShortNode extends NumericNode { protected final short _value; /* ************************************************ * Construction ************************************************ */ public ShortNode(short v) { _value = v; } public static ShortNode valueOf(short l) { return new ShortNode(l); } /* ************************************************ * Overridden JsonNode methods ************************************************ */ @Override public JsonToken asToken() { return JsonToken.VALUE_NUMBER_INT; } @Override public JsonParser.NumberType numberType() { return JsonParser.NumberType.INT; } // should be SHORT @Override public boolean isIntegralNumber() { return true; } @Override public boolean isShort() { return true; } @Override public boolean canConvertToInt() { return true; } @Override public boolean canConvertToLong() { return true; } @Override public Number numberValue() { return Short.valueOf(_value); } @Override public short shortValue() { return _value; } @Override public int intValue() { return _value; } @Override public long longValue() { return _value; } @Override public float floatValue() { return _value; } @Override public double doubleValue() { return _value; } @Override public BigDecimal decimalValue() { return BigDecimal.valueOf(_value); } @Override public BigInteger bigIntegerValue() { return BigInteger.valueOf(_value); } @Override public String asText() { return NumberOutput.toString(_value); } @Override public boolean asBoolean(boolean defaultValue) { return _value != 0; } @Override public final void serialize(JsonGenerator jg, SerializerProvider provider) throws IOException, JsonProcessingException { jg.writeNumber(_value); } @Override public boolean equals

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS>package com.fasterxml.jackson.databind.deser.std; import java.io.IOException; import java.util.*; import java.util.concurrent.ArrayBlockingQueue; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.core.JsonToken; import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.ValueInstantiator; import com.fasterxml.jackson.databind.jsontype.TypeDeserializer; /** * We need a custom deserializer both because {@link ArrayBlockingQueue} has no * default constructor AND because it has size limit used for constructing * underlying storage automatically. */ public class ArrayBlockingQueueDeserializer extends CollectionDeserializer { private static final long serialVersionUID = 1; /* /********************************************************** /* Life-cycle /********************************************************** */ public ArrayBlockingQueueDeserializer(JavaType collectionType, JsonDeserializer<Object> valueDeser, TypeDeserializer valueTypeDeser, ValueInstantiator valueInstantiator) { super(collectionType, valueDeser, valueTypeDeser, valueInstantiator); } /** * Constructor used when creating contextualized instances. */ protected ArrayBlockingQueueDeserializer(JavaType collectionType, JsonDeserializer<Object> valueDeser, TypeDeserializer valueTypeDeser, ValueInstantiator valueInstantiator, JsonDeserializer<Object> delegateDeser, Boolean unwrapSingle) { super(collectionType, valueDeser, valueTypeDeser, valueInstantiator, delegateDeser, unwrapSingle); } /** * Copy-constructor that can be used by sub-classes to allow * copy-on-write styling copying of settings of an existing instance. */ protected ArrayBlockingQueueDeserializer(ArrayBlockingQueueDeserializer src) { super(src); } /** * Fluent-factory method call to construct contextual instance. */ @Override @SuppressWarnings("unchecked") protected ArrayBlockingQueueDeserializer withResolved(JsonDeserializer<?> dd, JsonDeserializer<?> vd, TypeDeserializer vtd, Boolean unwrapSingle) { if ((dd == _delegateDeserializer) && (vd == _valueDeserializer) && (vtd == _valueTypeDeserializer) && (_unwrapSingle == unwrapSingle)) { return this; } return new ArrayBlockingQueueDeserializer(_collectionType, (JsonDeserializer

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS><Object>) vd, vtd, _valueInstantiator, (JsonDeserializer<Object>) dd, unwrapSingle); } /* /********************************************************** /* JsonDeserializer API /********************************************************** */ @SuppressWarnings("unchecked") @Override public Collection<Object> deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException { if (_delegateDeserializer != null) { return (Collection<Object>) _valueInstantiator.createUsingDelegate(ctxt, _delegateDeserializer.deserialize(jp, ctxt)); } if (jp.getCurrentToken() == JsonToken.VALUE_STRING) { String str = jp.getText(); if (str.length() == 0) { return (Collection<Object>) _valueInstantiator.createFromString(ctxt, str); } } return deserialize(jp, ctxt, null); } @Override public Collection<Object> deserialize(JsonParser jp, DeserializationContext ctxt, Collection<Object> result0) throws IOException { // Ok: must point to START_ARRAY (or equivalent) if (!jp.isExpectedStartArrayToken()) { return handleNonArray(jp, ctxt, new ArrayBlockingQueue<Object>(1)); } ArrayList<Object> tmp = new ArrayList<Object>(); JsonDeserializer<Object> valueDes = _valueDeserializer; JsonToken t; final TypeDeserializer typeDeser = _valueTypeDeserializer; try { while ((t = jp.nextToken()) != JsonToken.END_ARRAY) { Object value; if (t == JsonToken.VALUE_NULL) { value = valueDes.getNullValue(ctxt); } else if (typeDeser == null) { value = valueDes.deserialize(jp, ctxt); } else { value = valueDes.deserializeWithType(jp, ctxt, typeDeser); } tmp.add(value); } } catch (Exception e) { throw JsonMappingException.wrapWithPath(e, tmp, tmp.size()); } if (result0 != null) { result0.addAll(tmp); return result0; } return new ArrayBlockingQueue<Object>(tmp.size(), false, tmp); } @Override public Object deserializeWithType(JsonParser jp, DeserializationContext ctxt, TypeDeserializer typeDeserializer) throws IOException { // In

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS>package com.fasterxml.jackson.databind.node; import java.io.IOException; import java.io.OutputStream; import java.math.BigDecimal; import java.math.BigInteger; import com.fasterxml.jackson.core.*; import com.fasterxml.jackson.core.base.ParserMinimalBase; import com.fasterxml.jackson.databind.JsonNode; /** * Facade over {@link JsonNode} that implements {@link JsonParser} to allow * accessing contents of JSON tree in alternate form (stream of tokens). * Useful when a streaming source is expected by code, such as data binding * functionality. */ public class TreeTraversingParser extends ParserMinimalBase { /* /********************************************************** /* Configuration /********************************************************** */ protected ObjectCodec _objectCodec; /** * Traversal context within tree */ protected NodeCursor _nodeCursor; /* /********************************************************** /* State /********************************************************** */ /** * Sometimes parser needs to buffer a single look-ahead token; if so, * it'll be stored here. This is currently used for handling */ protected JsonToken _nextToken; /** * Flag needed to handle recursion into contents of child * Array/Object nodes. */ protected boolean _startContainer; /** * Flag that indicates whether parser is closed or not. Gets * set when parser is either closed by explicit call * ({@link #close}) or when end-of-input is reached. */ protected boolean _closed; /* /********************************************************** /* Life-cycle /********************************************************** */ public TreeTraversingParser(JsonNode n) { this(n, null); } public TreeTraversingParser(JsonNode n, ObjectCodec codec) { super(0); _objectCodec = codec; if (n.isArray()) { _nextToken = JsonToken.START_ARRAY; _nodeCursor = new NodeCursor.ArrayCursor(n, null); } else if (n.isObject()) { _nextToken = JsonToken.START_OBJECT; _nodeCursor = new NodeCursor.ObjectCursor(n, null); } else { // value node _nodeCursor = new NodeCursor.RootCursor(n, null); } } @Override public void setCodec(ObjectCodec c)

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS> { _objectCodec = c; } @Override public ObjectCodec getCodec() { return _objectCodec; } @Override public Version version() { return com.fasterxml.jackson.databind.cfg.PackageVersion.VERSION; } /* /********************************************************** /* Closeable implementation /********************************************************** */ @Override public void close() throws IOException { if (!_closed) { _closed = true; _nodeCursor = null; _currToken = null; } } /* /********************************************************** /* Public API, traversal /********************************************************** */ @Override public JsonToken nextToken() throws IOException, JsonParseException { if (_nextToken != null) { _currToken = _nextToken; _nextToken = null; return _currToken; } // are we to descend to a container child? if (_startContainer) { _startContainer = false; // minor optimization: empty containers can be skipped if (!_nodeCursor.currentHasChildren()) { _currToken = (_currToken == JsonToken.START_OBJECT) ? JsonToken.END_OBJECT : JsonToken.END_ARRAY; return _currToken; } _nodeCursor = _nodeCursor.iterateChildren(); _currToken = _nodeCursor.nextToken(); if (_currToken == JsonToken.START_OBJECT || _currToken == JsonToken.START_ARRAY) { _startContainer = true; } return _currToken; } // No more content? if (_nodeCursor == null) { _closed = true; // if not already set return null; } // Otherwise, next entry from current cursor _currToken = _nodeCursor.nextToken(); if (_currToken != null) { if (_currToken == JsonToken.START_OBJECT || _currToken == JsonToken.START_ARRAY) { _startContainer = true; } return _currToken; } // null means no more children; need to return end marker _currToken = _nodeCursor.endToken(); _nodeCursor = _nodeCursor.getParent(); return _currToken; } // default works well here: //public JsonToken nextValue() throws IOException, JsonParseException @Override public JsonParser skipChildren

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS>() throws IOException, JsonParseException { if (_currToken == JsonToken.START_OBJECT) { _startContainer = false; _currToken = JsonToken.END_OBJECT; } else if (_currToken == JsonToken.START_ARRAY) { _startContainer = false; _currToken = JsonToken.END_ARRAY; } return this; } @Override public boolean isClosed() { return _closed; } /* /********************************************************** /* Public API, token accessors /********************************************************** */ @Override public String getCurrentName() { return (_nodeCursor == null) ? null : _nodeCursor.getCurrentName(); } @Override public void overrideCurrentName(String name) { if (_nodeCursor != null) { _nodeCursor.overrideCurrentName(name); } } @Override public JsonStreamContext getParsingContext() { return _nodeCursor; } @Override public JsonLocation getTokenLocation() { return JsonLocation.NA; } @Override public JsonLocation getCurrentLocation() { return JsonLocation.NA; } /* /********************************************************** /* Public API, access to textual content /********************************************************** */ @Override public String getText() { if (_closed) { return null; } // need to separate handling a bit... switch (_currToken) { case FIELD_NAME: return _nodeCursor.getCurrentName(); case VALUE_STRING: return currentNode().textValue(); case VALUE_NUMBER_INT: case VALUE_NUMBER_FLOAT: return String.valueOf(currentNode().numberValue()); case VALUE_EMBEDDED_OBJECT: JsonNode n = currentNode(); if (n != null && n.isBinary()) { // this will convert it to base64 return n.asText(); } default: return (_currToken == null) ? null : _currToken.asString(); } } @Override public char[] getTextCharacters() throws IOException, JsonParseException { return getText().toCharArray(); } @Override public int getTextLength() throws IOException, JsonParseException { return getText().length(); } @Override public int getTextOffset() throws IOException, JsonParseException { return 0; } @

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS>? if (n.isPojo()) { Object ob = ((POJONode) n).getPojo(); if (ob instanceof byte[]) { return (byte[]) ob; } } } // otherwise return null to mark we have no binary content return null; } @Override public int readBinaryValue(Base64Variant b64variant, OutputStream out) throws IOException, JsonParseException { byte[] data = getBinaryValue(b64variant); if (data != null) { out.write(data, 0, data.length); return data.length; } return 0; } /* /********************************************************** /* Internal methods /********************************************************** */ protected JsonNode currentNode() { if (_closed || _nodeCursor == null) { return null; } return _nodeCursor.currentNode(); } protected JsonNode currentNumericNode() throws JsonParseException { JsonNode n = currentNode(); if (n == null || !n.isNumber()) { JsonToken t = (n == null) ? null : n.asToken(); throw _constructError("Current token ("+t+") not numeric, can not use numeric value accessors"); } return n; } @Override protected void _handleEOF() throws JsonParseException { _throwInternal(); // should never get called } }

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS>package com.fasterxml.jackson.databind.node; import java.io.IOException; import java.math.BigDecimal; import java.math.BigInteger; import com.fasterxml.jackson.core.*; import com.fasterxml.jackson.databind.SerializerProvider; /** * <code>JsonNode</code> implementation for efficiently containing 32-bit * `float` values. * * @since 2.2 */ public class FloatNode extends NumericNode { protected final float _value; /* /********************************************************** /* Construction /********************************************************** */ public FloatNode(float v) { _value = v; } public static FloatNode valueOf(float v) { return new FloatNode(v); } /* /********************************************************** /* BaseJsonNode extended API /********************************************************** */ @Override public JsonToken asToken() { return JsonToken.VALUE_NUMBER_FLOAT; } @Override public JsonParser.NumberType numberType() { return JsonParser.NumberType.FLOAT; } /* /********************************************************** /* Overrridden JsonNode methods /********************************************************** */ @Override public boolean isFloatingPointNumber() { return true; } @Override public boolean isFloat() { return true; } @Override public boolean canConvertToInt() { return (_value >= Integer.MIN_VALUE && _value <= Integer.MAX_VALUE); } @Override public boolean canConvertToLong() { return (_value >= Long.MIN_VALUE && _value <= Long.MAX_VALUE); } @Override public Number numberValue() { return Float.valueOf(_value); } @Override public short shortValue() { return (short) _value; } @Override public int intValue() { return (int) _value; } @Override public long longValue() { return (long) _value; } @Override public float floatValue() { return (float) _value; } @Override public double doubleValue() { return _value; } @Override public BigDecimal decimalValue() { return BigDecimal.valueOf(_value); } @Override public BigInteger bigIntegerValue() { return decimalValue().toBigInteger(); } @Override public String asText() { // As per [jackson-databind#707

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS>package com.fasterxml.jackson.databind.node; import java.io.IOException; import java.math.BigDecimal; import java.math.BigInteger; import com.fasterxml.jackson.core.*; import com.fasterxml.jackson.databind.*; /** * Numeric node that contains values that do not fit in simple * integer (int, long) or floating point (double) values. */ public class DecimalNode extends NumericNode { public static final DecimalNode ZERO = new DecimalNode(BigDecimal.ZERO); private final static BigDecimal MIN_INTEGER = BigDecimal.valueOf(Integer.MIN_VALUE); private final static BigDecimal MAX_INTEGER = BigDecimal.valueOf(Integer.MAX_VALUE); private final static BigDecimal MIN_LONG = BigDecimal.valueOf(Long.MIN_VALUE); private final static BigDecimal MAX_LONG = BigDecimal.valueOf(Long.MAX_VALUE); final protected BigDecimal _value; /* /********************************************************** /* Construction /********************************************************** */ public DecimalNode(BigDecimal v) { _value = v; } public static DecimalNode valueOf(BigDecimal d) { return new DecimalNode(d); } /* /********************************************************** /* BaseJsonNode extended API /********************************************************** */ @Override public JsonToken asToken() { return JsonToken.VALUE_NUMBER_FLOAT; } @Override public JsonParser.NumberType numberType() { return JsonParser.NumberType.BIG_DECIMAL; } /* /********************************************************** /* Overrridden JsonNode methods /********************************************************** */ @Override public boolean isFloatingPointNumber() { return true; } @Override public boolean isBigDecimal() { return true; } @Override public boolean canConvertToInt() { return (_value.compareTo(MIN_INTEGER) >= 0) && (_value.compareTo(MAX_INTEGER) <= 0); } @Override public boolean canConvertToLong() { return (_value.compareTo(MIN_LONG) >= 0) && (_value.compareTo(MAX_LONG) <= 0); } @Override public Number numberValue() { return _value; } @Override public short shortValue() { return _value.shortValue(); } @Override public int intValue() { return _value.intValue(); } @Override public long longValue() { return _value.

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS>package com.fasterxml.jackson.databind.node; import java.math.BigDecimal; import java.math.BigInteger; import com.fasterxml.jackson.core.*; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.util.RawValue; /** * This intermediate base class is used for all container nodes, * specifically, array and object nodes. */ public abstract class ContainerNode<T extends ContainerNode<T>> extends BaseJsonNode implements JsonNodeCreator { /** * We will keep a reference to the Object (usually TreeMapper) * that can construct instances of nodes to add to this container * node. */ protected final JsonNodeFactory _nodeFactory; protected ContainerNode(JsonNodeFactory nc) { _nodeFactory = nc; } // all containers are mutable: can't define: // @Override public abstract <T extends JsonNode> T deepCopy(); @Override public abstract JsonToken asToken(); @Override public String asText() { return ""; } /* /********************************************************** /* Methods reset as abstract to force real implementation /********************************************************** */ @Override public abstract int size(); @Override public abstract JsonNode get(int index); @Override public abstract JsonNode get(String fieldName); /* /********************************************************** /* JsonNodeCreator implementation, just dispatch to /* the real creator /********************************************************** */ /** * Factory method that constructs and returns an empty {@link ArrayNode} * Construction is done using registered {@link JsonNodeFactory}. */ @Override public final ArrayNode arrayNode() { return _nodeFactory.arrayNode(); } /** * Factory method that constructs and returns an empty {@link ObjectNode} * Construction is done using registered {@link JsonNodeFactory}. */ @Override public final ObjectNode objectNode() { return _nodeFactory.objectNode(); } @Override public final NullNode nullNode() { return _nodeFactory.nullNode(); } @Override public final BooleanNode booleanNode(boolean v) { return _nodeFactory.booleanNode(v); } @Override public final NumericNode numberNode(byte v) { return _nodeFactory.numberNode(v); } @Override public final NumericNode numberNode(short v) { return _nodeFactory.

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS>package com.fasterxml.jackson.databind.deser.std; import java.io.IOException; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.core.JsonToken; import com.fasterxml.jackson.databind.DeserializationContext; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.JsonMappingException; public class StackTraceElementDeserializer extends StdScalarDeserializer<StackTraceElement> { private static final long serialVersionUID = 1L; public StackTraceElementDeserializer() { super(StackTraceElement.class); } @Override public StackTraceElement deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException { JsonToken t = jp.getCurrentToken(); // Must get an Object if (t == JsonToken.START_OBJECT) { String className = "", methodName = "", fileName = ""; int lineNumber = -1; while ((t = jp.nextValue()) != JsonToken.END_OBJECT) { String propName = jp.getCurrentName(); if ("className".equals(propName)) { className = jp.getText(); } else if ("fileName".equals(propName)) { fileName = jp.getText(); } else if ("lineNumber".equals(propName)) { if (t.isNumeric()) { lineNumber = jp.getIntValue(); } else { throw JsonMappingException.from(jp, "Non-numeric token ("+t+") for property 'lineNumber'"); } } else if ("methodName".equals(propName)) { methodName = jp.getText(); } else if ("nativeMethod".equals(propName)) { // no setter, not passed via constructor: ignore } else { handleUnknownProperty(jp, ctxt, _valueClass, propName); } } return new StackTraceElement(className, methodName, fileName, lineNumber); } else if (t == JsonToken.START_ARRAY && ctxt.isEnabled(DeserializationFeature.UNWRAP_SINGLE_VALUE_ARRAYS)) { jp.nextToken(); final StackTraceElement value = deserialize(jp, ctxt); if (jp.nextToken() != JsonToken.END_ARRAY) { throw ctxt.wrongTokenException(jp, JsonToken.END_ARRAY, "Attempted to unwrap single value array for

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS>ID_FALSE: return Boolean.FALSE; case JsonTokenId.ID_NULL: // should not get this far really but... return null; default: } throw ctxt.mappingException(Object.class); } /* /********************************************************** /* Internal methods /********************************************************** */ /** * Method called to map a JSON Array into a Java value. */ protected Object mapArray(JsonParser jp, DeserializationContext ctxt) throws IOException { // Minor optimization to handle small lists (default size for ArrayList is 10) if (jp.nextToken() == JsonToken.END_ARRAY) { return new ArrayList<Object>(2); } Object value = deserialize(jp, ctxt); if (jp.nextToken() == JsonToken.END_ARRAY) { ArrayList<Object> l = new ArrayList<Object>(2); l.add(value); return l; } Object value2 = deserialize(jp, ctxt); if (jp.nextToken() == JsonToken.END_ARRAY) { ArrayList<Object> l = new ArrayList<Object>(2); l.add(value); l.add(value2); return l; } ObjectBuffer buffer = ctxt.leaseObjectBuffer(); Object[] values = buffer.resetAndStart(); int ptr = 0; values[ptr++] = value; values[ptr++] = value2; int totalSize = ptr; do { value = deserialize(jp, ctxt); ++totalSize; if (ptr >= values.length) { values = buffer.appendCompletedChunk(values); ptr = 0; } values[ptr++] = value; } while (jp.nextToken() != JsonToken.END_ARRAY); // let's create full array then ArrayList<Object> result = new ArrayList<Object>(totalSize); buffer.completeAndClearBuffer(values, ptr, result); return result; } /** * Method called to map a JSON Object into a Java value. */ protected Object mapObject(JsonParser p, DeserializationContext ctxt) throws IOException { String key1; JsonToken t = p.getCurrentToken(); if (t == JsonToken.START_OBJECT) { key1 = p.nextFieldName(); }

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS> else if (t == JsonToken.FIELD_NAME) { key1 = p.getCurrentName(); } else { if (t != JsonToken.END_OBJECT) { throw ctxt.mappingException(handledType(), p.getCurrentToken()); } key1 = null; } if (key1 == null) { // empty map might work; but caller may want to modify... so better just give small modifiable return new LinkedHashMap<String,Object>(2); } // minor optimization; let's handle 1 and 2 entry cases separately // 24-Mar-2015, tatu: Ideally, could use one of 'nextXxx()' methods, but for // that we'd need new method(s) in JsonDeserializer. So not quite yet. p.nextToken(); Object value1 = deserialize(p, ctxt); String key2 = p.nextFieldName(); if (key2 == null) { // has to be END_OBJECT, then // single entry; but we want modifiable LinkedHashMap<String, Object> result = new LinkedHashMap<String, Object>(2); result.put(key1, value1); return result; } p.nextToken(); Object value2 = deserialize(p, ctxt); String key = p.nextFieldName(); if (key == null) { LinkedHashMap<String, Object> result = new LinkedHashMap<String, Object>(4); result.put(key1, value1); result.put(key2, value2); return result; } // And then the general case; default map size is 16 LinkedHashMap<String, Object> result = new LinkedHashMap<String, Object>(); result.put(key1, value1); result.put(key2, value2); do { p.nextToken(); result.put(key, deserialize(p, ctxt)); } while ((key = p.nextFieldName()) != null); return result; } /** * Method called to map a JSON Array into a Java Object array (Object[]). */ protected Object[] mapArrayToArray(JsonParser jp, DeserializationContext ctxt) throws IOException { // Minor optimization to handle small lists (default size for ArrayList is 10) if (jp.nextToken() == Json

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS>Token.END_ARRAY) { return NO_OBJECTS; } ObjectBuffer buffer = ctxt.leaseObjectBuffer(); Object[] values = buffer.resetAndStart(); int ptr = 0; do { Object value = deserialize(jp, ctxt); if (ptr >= values.length) { values = buffer.appendCompletedChunk(values); ptr = 0; } values[ptr++] = value; } while (jp.nextToken() != JsonToken.END_ARRAY); return buffer.completeAndClearBuffer(values, ptr); } /* /********************************************************** /* Separate "vanilla" implementation for common case of /* no custom deserializer overrides /********************************************************** */ @JacksonStdImpl public static class Vanilla extends StdDeserializer<Object> { private static final long serialVersionUID = 1L; public final static Vanilla std = new Vanilla(); public Vanilla() { super(Object.class); } @Override public Object deserialize(JsonParser p, DeserializationContext ctxt) throws IOException { switch (p.getCurrentTokenId()) { case JsonTokenId.ID_START_OBJECT: { JsonToken t = p.nextToken(); if (t == JsonToken.END_OBJECT) { return new LinkedHashMap<String,Object>(2); } } case JsonTokenId.ID_FIELD_NAME: return mapObject(p, ctxt); case JsonTokenId.ID_START_ARRAY: { JsonToken t = p.nextToken(); if (t == JsonToken.END_ARRAY) { // and empty one too if (ctxt.isEnabled(DeserializationFeature.USE_JAVA_ARRAY_FOR_JSON_ARRAY)) { return NO_OBJECTS; } return new ArrayList<Object>(2); } } if (ctxt.isEnabled(DeserializationFeature.USE_JAVA_ARRAY_FOR_JSON_ARRAY)) { return mapArrayToArray(p, ctxt); } return mapArray(p, ctxt); case JsonTokenId.ID_EMBEDDED_OBJECT: return p.getEmbeddedObject(); case JsonTokenId.ID_STRING: return p.getText(); case JsonTokenId.ID_NUMBER_INT: if (ctxt.hasSomeOfFeatures(F_MASK

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS>: return jp.getEmbeddedObject(); case JsonTokenId.ID_NULL: // should not get this far really but... return null; default: throw ctxt.mappingException(Object.class); } } protected Object mapArray(JsonParser jp, DeserializationContext ctxt) throws IOException { Object value = deserialize(jp, ctxt); if (jp.nextToken() == JsonToken.END_ARRAY) { ArrayList<Object> l = new ArrayList<Object>(2); l.add(value); return l; } Object value2 = deserialize(jp, ctxt); if (jp.nextToken() == JsonToken.END_ARRAY) { ArrayList<Object> l = new ArrayList<Object>(2); l.add(value); l.add(value2); return l; } ObjectBuffer buffer = ctxt.leaseObjectBuffer(); Object[] values = buffer.resetAndStart(); int ptr = 0; values[ptr++] = value; values[ptr++] = value2; int totalSize = ptr; do { value = deserialize(jp, ctxt); ++totalSize; if (ptr >= values.length) { values = buffer.appendCompletedChunk(values); ptr = 0; } values[ptr++] = value; } while (jp.nextToken() != JsonToken.END_ARRAY); // let's create full array then ArrayList<Object> result = new ArrayList<Object>(totalSize); buffer.completeAndClearBuffer(values, ptr, result); return result; } /** * Method called to map a JSON Object into a Java value. */ protected Object mapObject(JsonParser p, DeserializationContext ctxt) throws IOException { // will point to FIELD_NAME at this point, guaranteed String key1 = p.getText(); p.nextToken(); Object value1 = deserialize(p, ctxt); String key2 = p.nextFieldName(); if (key2 == null) { // single entry; but we want modifiable LinkedHashMap<String, Object> result = new LinkedHashMap<String, Object>(2); result.put(key1, value1); return result; } p.nextToken(); Object value2 = deserialize(p, ctxt); String key

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS> = p.nextFieldName(); if (key == null) { LinkedHashMap<String, Object> result = new LinkedHashMap<String, Object>(4); result.put(key1, value1); result.put(key2, value2); return result; } // And then the general case; default map size is 16 LinkedHashMap<String, Object> result = new LinkedHashMap<String, Object>(); result.put(key1, value1); result.put(key2, value2); do { p.nextToken(); result.put(key, deserialize(p, ctxt)); } while ((key = p.nextFieldName()) != null); return result; } /** * Method called to map a JSON Array into a Java Object array (Object[]). */ protected Object[] mapArrayToArray(JsonParser jp, DeserializationContext ctxt) throws IOException { ObjectBuffer buffer = ctxt.leaseObjectBuffer(); Object[] values = buffer.resetAndStart(); int ptr = 0; do { Object value = deserialize(jp, ctxt); if (ptr >= values.length) { values = buffer.appendCompletedChunk(values); ptr = 0; } values[ptr++] = value; } while (jp.nextToken() != JsonToken.END_ARRAY); return buffer.completeAndClearBuffer(values, ptr); } } }

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS>ProcessingException { /* 02-Mar-2009, tatu: One twist; deserialization provider * will map JSON null straight into Java null. But what * we want to return is the "null node" instead. */ /* 05-Aug-2011, tatu: Also, must check for EOF here before * calling readValue(), since that'll choke on it otherwise */ DeserializationConfig cfg = getDeserializationConfig(); JsonToken t = jp.getCurrentToken(); if (t == null) { t = jp.nextToken(); if (t == null) { return null; } } JsonNode n = (JsonNode) _readValue(cfg, jp, JSON_NODE_TYPE); if (n == null) { n = getNodeFactory().nullNode(); } @SuppressWarnings("unchecked") T result = (T) n; return result; } /** * Convenience method, equivalent in function to: *<pre> * readerFor(valueType).readValues(p); *</pre> *<p> * Method for reading sequence of Objects from parser stream. * Sequence can be either root-level "unwrapped" sequence (without surrounding * JSON array), or a sequence contained in a JSON Array. * In either case {@link JsonParser} <b>MUST</b> point to the first token of * the first element, OR not point to any token (in which case it is advanced * to the next token). This means, specifically, that for wrapped sequences, * parser MUST NOT point to the surrounding <code>START_ARRAY</code> (one that * contains values to read) but rather to the token following it which is the first * token of the first value to read. *<p> * Note that {@link ObjectReader} has more complete set of variants. */ @Override public <T> MappingIterator<T> readValues(JsonParser p, ResolvedType valueType) throws IOException, JsonProcessingException { return readValues(p, (JavaType) valueType); } /** * Convenience method, equivalent in function to: *<pre> * readerFor(valueType).readValues(p); *</pre> *

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS>FOR_FLOATS)) { buf = buf.forceUseOfBigDecimal(true); } try { // inlined 'writeValue' with minor changes: // first: disable wrapping when writing SerializationConfig config = getSerializationConfig().without(SerializationFeature.WRAP_ROOT_VALUE); // no need to check for closing of TokenBuffer _serializerProvider(config).serializeValue(buf, fromValue); // then matching read, inlined 'readValue' with minor mods: final JsonParser jp = buf.asParser(); Object result; // ok to pass in existing feature flags; unwrapping handled by mapper final DeserializationConfig deserConfig = getDeserializationConfig(); JsonToken t = _initForReading(jp); if (t == JsonToken.VALUE_NULL) { DeserializationContext ctxt = createDeserializationContext(jp, deserConfig); result = _findRootDeserializer(ctxt, toValueType).getNullValue(ctxt); } else if (t == JsonToken.END_ARRAY || t == JsonToken.END_OBJECT) { result = null; } else { // pointing to event other than null DeserializationContext ctxt = createDeserializationContext(jp, deserConfig); JsonDeserializer<Object> deser = _findRootDeserializer(ctxt, toValueType); // note: no handling of unwarpping result = deser.deserialize(jp, ctxt); } jp.close(); return result; } catch (IOException e) { // should not occur, no real i/o... throw new IllegalArgumentException(e.getMessage(), e); } } /* /********************************************************** /* Extended Public API: JSON Schema generation /********************************************************** */ /** * Generate <a href="http://json-schema.org/">Json-schema</a> * instance for specified class. * * @param t The class to generate schema for * @return Constructed JSON schema. * * @deprecated Since 2.6 use external JSON Schema generator (https://github.com/FasterXML/jackson-module-jsonSchema) * (which under the hood calls {@link #acceptJsonFormatVisitor(JavaType, JsonFormatVisitorWrapper)}) */ @Deprecated public com.fasterxml.jackson.databind.jsonschema.JsonSchema generateJsonSchema(Class<?> t) throws JsonMappingException {

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS> * Actual implementation of value reading+binding operation. */ protected Object _readValue(DeserializationConfig cfg, JsonParser jp, JavaType valueType) throws IOException, JsonParseException, JsonMappingException { /* First: may need to read the next token, to initialize * state (either before first read from parser, or after * previous token has been cleared) */ Object result; JsonToken t = _initForReading(jp); if (t == JsonToken.VALUE_NULL) { // [JACKSON-643]: Ask JsonDeserializer what 'null value' to use: DeserializationContext ctxt = createDeserializationContext(jp, cfg); result = _findRootDeserializer(ctxt, valueType).getNullValue(ctxt); } else if (t == JsonToken.END_ARRAY || t == JsonToken.END_OBJECT) { result = null; } else { // pointing to event other than null DeserializationContext ctxt = createDeserializationContext(jp, cfg); JsonDeserializer<Object> deser = _findRootDeserializer(ctxt, valueType); // ok, let's get the value if (cfg.useRootWrapping()) { result = _unwrapAndDeserialize(jp, ctxt, cfg, valueType, deser); } else { result = deser.deserialize(jp, ctxt); } } // Need to consume the token too jp.clearCurrentToken(); return result; } protected Object _readMapAndClose(JsonParser jp, JavaType valueType) throws IOException, JsonParseException, JsonMappingException { try { Object result; JsonToken t = _initForReading(jp); if (t == JsonToken.VALUE_NULL) { // [JACKSON-643]: Ask JsonDeserializer what 'null value' to use: DeserializationContext ctxt = createDeserializationContext(jp, getDeserializationConfig()); result = _findRootDeserializer(ctxt, valueType).getNullValue(ctxt); } else if (t == JsonToken.END_ARRAY || t == JsonToken.END_OBJECT) { result = null; } else { DeserializationConfig cfg = getDeserializationConfig(); DeserializationContext ctxt = createDeserializationContext(jp, cfg); JsonDeserializer<Object> deser = _findRootDeserializer(ctxt, valueType);

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS> if (cfg.useRootWrapping()) { result = _unwrapAndDeserialize(jp, ctxt, cfg, valueType, deser); } else { result = deser.deserialize(jp, ctxt); } ctxt.checkUnresolvedObjectId(); } // Need to consume the token too jp.clearCurrentToken(); return result; } finally { try { jp.close(); } catch (IOException ioe) { } } } /** * Method called to ensure that given parser is ready for reading * content for data binding. * * @return First token to be used for data binding after this call: * can never be null as exception will be thrown if parser can not * provide more tokens. * * @throws IOException if the underlying input source has problems during * parsing * @throws JsonParseException if parser has problems parsing content * @throws JsonMappingException if the parser does not have any more * content to map (note: Json "null" value is considered content; * enf-of-stream not) */ protected JsonToken _initForReading(JsonParser p) throws IOException { _deserializationConfig.initialize(p); // since 2.5 /* First: must point to a token; if not pointing to one, advance. * This occurs before first read from JsonParser, as well as * after clearing of current token. */ JsonToken t = p.getCurrentToken(); if (t == null) { // and then we must get something... t = p.nextToken(); if (t == null) { // Throw mapping exception, since it's failure to map, // not an actual parsing problem throw JsonMappingException.from(p, "No content to map due to end-of-input"); } } return t; } protected Object _unwrapAndDeserialize(JsonParser p, DeserializationContext ctxt, DeserializationConfig config, JavaType rootType, JsonDeserializer<Object> deser) throws IOException { PropertyName expRootName = config.findRootName(rootType); // 12-Jun-2015, tatu: Should try to support namespaces etc but... String expSimpleName = expRootName.getSimpleName(); if (p

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS>.getCurrentToken() != JsonToken.START_OBJECT) { throw JsonMappingException.from(p, "Current token not START_OBJECT (needed to unwrap root name '" +expSimpleName+"'), but "+p.getCurrentToken()); } if (p.nextToken() != JsonToken.FIELD_NAME) { throw JsonMappingException.from(p, "Current token not FIELD_NAME (to contain expected root name '" +expSimpleName+"'), but "+p.getCurrentToken()); } String actualName = p.getCurrentName(); if (!expSimpleName.equals(actualName)) { throw JsonMappingException.from(p, "Root name '"+actualName+"' does not match expected ('" +expSimpleName+"') for type "+rootType); } // ok, then move to value itself.... p.nextToken(); Object result = deser.deserialize(p, ctxt); // and last, verify that we now get matching END_OBJECT if (p.nextToken() != JsonToken.END_OBJECT) { throw JsonMappingException.from(p, "Current token not END_OBJECT (to match wrapper object with root name '" +expSimpleName+"'), but "+p.getCurrentToken()); } return result; } /* /********************************************************** /* Internal methods, other /********************************************************** */ /** * Method called to locate deserializer for the passed root-level value. */ protected JsonDeserializer<Object> _findRootDeserializer(DeserializationContext ctxt, JavaType valueType) throws JsonMappingException { // First: have we already seen it? JsonDeserializer<Object> deser = _rootDeserializers.get(valueType); if (deser != null) { return deser; } // Nope: need to ask provider to resolve it deser = ctxt.findRootValueDeserializer(valueType); if (deser == null) { // can this happen? throw JsonMappingException.from(ctxt, "Can not find a deserializer for type "+valueType); } _rootDeserializers.put(valueType, deser); return deser; } /** * @since 2.2 */ protected void _verifySchemaType(FormatSchema schema) { if (schema != null) { if (!_jsonFactory.canUseSchema

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS> Methods for problem handling, reporting /********************************************************** */ /** * Method deserializers can call to inform configured {@link DeserializationProblemHandler}s * of an unrecognized property. * * @return True if there was a configured problem handler that was able to handle the * problem */ /** * Method deserializers can call to inform configured {@link DeserializationProblemHandler}s * of an unrecognized property. */ public boolean handleUnknownProperty(JsonParser p, JsonDeserializer<?> deser, Object instanceOrClass, String propName) throws IOException, JsonProcessingException { LinkedNode<DeserializationProblemHandler> h = _config.getProblemHandlers(); if (h != null) { while (h != null) { // Can bail out if it's handled if (h.value().handleUnknownProperty(this, p, deser, instanceOrClass, propName)) { return true; } h = h.next(); } } return false; } /** * Helper method for reporting a problem with unhandled unknown exception * * @param instanceOrClass Either value being populated (if one has been * instantiated), or Class that indicates type that would be (or * have been) instantiated * @param deser Deserializer that had the problem, if called by deserializer * (or on behalf of one) */ public void reportUnknownProperty(Object instanceOrClass, String fieldName, JsonDeserializer<?> deser) throws JsonMappingException { if (!isEnabled(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)) { return; } // Do we know properties that are expected instead? Collection<Object> propIds = (deser == null) ? null : deser.getKnownPropertyNames(); throw UnrecognizedPropertyException.from(_parser, instanceOrClass, fieldName, propIds); } /* /********************************************************** /* Methods for constructing exceptions /********************************************************** */ /** * Helper method for constructing generic mapping exception for specified type */ public JsonMappingException mappingException(Class<?> targetClass) { return mappingException(targetClass, _parser.getCurrentToken()); } public JsonMappingException mappingException(Class<?> targetClass, JsonToken token) { return JsonMappingException.from(_parser, String.format("

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS>(_parser, String.format("Can not construct instance of %s from number value (%s): %s", instClass.getName(), String.valueOf(value), msg), value, instClass); } /** * Helper method for constructing exception to indicate that given JSON * Object field name was not in format to be able to deserialize specified * key type. */ public JsonMappingException weirdKeyException(Class<?> keyClass, String keyValue, String msg) { return InvalidFormatException.from(_parser, String.format("Can not construct Map key of type %s from String (%s): %s", keyClass.getName(), _quotedString(keyValue), msg), keyValue, keyClass); } /** * Helper method for indicating that the current token was expected to be another * token. */ public JsonMappingException wrongTokenException(JsonParser p, JsonToken expToken, String msg0) { String msg = String.format("Unexpected token (%s), expected %s", p.getCurrentToken(), expToken); if (msg0 != null) { msg = msg + ": "+msg0; } return JsonMappingException.from(p, msg); } /** * Helper method for constructing exception to indicate that given * type id (parsed from JSON) could not be converted to a Java type. */ @Deprecated // since 2.5, use overloaded variant public JsonMappingException unknownTypeException(JavaType type, String id) { return JsonMappingException.from(_parser, "Could not resolve type id '"+id+"' into a subtype of "+type); } /** * @since 2.5 */ public JsonMappingException unknownTypeException(JavaType type, String id, String extraDesc) { String msg = "Could not resolve type id '"+id+"' into a subtype of "+type; if (extraDesc != null) { msg = msg + ": "+extraDesc; } return JsonMappingException.from(_parser, msg); } public JsonMappingException endOfInputException(Class<?> instClass) { return JsonMappingException.from(_parser, "Unexpected end-of-input when trying to deserialize a " +instClass.getName()); } /* /********************************************************** /* Overridable internal

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS>.nextToken(); final Character C = deserialize(p, ctxt); if (p.nextToken() != JsonToken.END_ARRAY) { throw ctxt.wrongTokenException(p, JsonToken.END_ARRAY, "Attempted to unwrap single value array for single '" + _valueClass.getName() + "' value but there was more than a single value in the array" ); } return C; } } throw ctxt.mappingException(_valueClass, p.getCurrentToken()); } } @JacksonStdImpl public final static class IntegerDeserializer extends PrimitiveOrWrapperDeserializer<Integer> { private static final long serialVersionUID = 1L; final static IntegerDeserializer primitiveInstance = new IntegerDeserializer(Integer.TYPE, Integer.valueOf(0)); final static IntegerDeserializer wrapperInstance = new IntegerDeserializer(Integer.class, null); public IntegerDeserializer(Class<Integer> cls, Integer nvl) { super(cls, nvl); } // since 2.6, slightly faster lookups for this very common type @Override public boolean isCachable() { return true; } @Override public Integer deserialize(JsonParser p, DeserializationContext ctxt) throws IOException { if (p.hasToken(JsonToken.VALUE_NUMBER_INT)) { return p.getIntValue(); } return _parseInteger(p, ctxt); } // Since we can never have type info ("natural type"; String, Boolean, Integer, Double): // (is it an error to even call this version?) @Override public Integer deserializeWithType(JsonParser p, DeserializationContext ctxt, TypeDeserializer typeDeserializer) throws IOException { if (p.hasToken(JsonToken.VALUE_NUMBER_INT)) { return p.getIntValue(); } return _parseInteger(p, ctxt); } } @JacksonStdImpl public final static class LongDeserializer extends PrimitiveOrWrapperDeserializer<Long> { private static final long serialVersionUID = 1L; final static LongDeserializer primitiveInstance = new LongDeserializer(Long.TYPE, Long.valueOf(0L)); final static LongDeserializer wrapperInstance = new LongDeserializer(Long.class, null); public LongDeserializer(Class<Long> cls, Long nvl) { super(cls, nvl);

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS> } // since 2.6, slightly faster lookups for this very common type @Override public boolean isCachable() { return true; } @Override public Long deserialize(JsonParser p, DeserializationContext ctxt) throws IOException { if (p.hasToken(JsonToken.VALUE_NUMBER_INT)) { return p.getLongValue(); } return _parseLong(p, ctxt); } } @JacksonStdImpl public static class FloatDeserializer extends PrimitiveOrWrapperDeserializer<Float> { private static final long serialVersionUID = 1L; final static FloatDeserializer primitiveInstance = new FloatDeserializer(Float.TYPE, 0.f); final static FloatDeserializer wrapperInstance = new FloatDeserializer(Float.class, null); public FloatDeserializer(Class<Float> cls, Float nvl) { super(cls, nvl); } @Override public Float deserialize(JsonParser p, DeserializationContext ctxt) throws IOException { return _parseFloat(p, ctxt); } } @JacksonStdImpl public static class DoubleDeserializer extends PrimitiveOrWrapperDeserializer<Double> { private static final long serialVersionUID = 1L; final static DoubleDeserializer primitiveInstance = new DoubleDeserializer(Double.TYPE, 0.d); final static DoubleDeserializer wrapperInstance = new DoubleDeserializer(Double.class, null); public DoubleDeserializer(Class<Double> cls, Double nvl) { super(cls, nvl); } @Override public Double deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException { return _parseDouble(jp, ctxt); } // Since we can never have type info ("natural type"; String, Boolean, Integer, Double): // (is it an error to even call this version?) @Override public Double deserializeWithType(JsonParser jp, DeserializationContext ctxt, TypeDeserializer typeDeserializer) throws IOException { return _parseDouble(jp, ctxt); } } /** * For type <code>Number.class</code>, we can just rely on type * mappings that plain {@link JsonParser#getNumberValue} returns. *<p> * There is one additional complication: some numeric * types (specifically, int/Integer and double/Double) are "non-typed"; * meaning

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS>_VALUE) { return Integer.valueOf((int) value); } } return Long.valueOf(value); } catch (IllegalArgumentException iae) { throw ctxt.weirdStringException(text, _valueClass, "not a valid number"); } case JsonTokenId.ID_START_ARRAY: if (ctxt.isEnabled(DeserializationFeature.UNWRAP_SINGLE_VALUE_ARRAYS)) { p.nextToken(); final Object value = deserialize(p, ctxt); if (p.nextToken() != JsonToken.END_ARRAY) { throw ctxt.wrongTokenException(p, JsonToken.END_ARRAY, "Attempted to unwrap single value array for single '" + _valueClass.getName() + "' value but there was more than a single value in the array" ); } return value; } break; } // Otherwise, no can do: throw ctxt.mappingException(_valueClass, p.getCurrentToken()); } /** * As mentioned in class Javadoc, there is additional complexity in * handling potentially mixed type information here. Because of this, * we must actually check for "raw" integers and doubles first, before * calling type deserializer. */ @Override public Object deserializeWithType(JsonParser jp, DeserializationContext ctxt, TypeDeserializer typeDeserializer) throws IOException { switch (jp.getCurrentTokenId()) { case JsonTokenId.ID_NUMBER_INT: case JsonTokenId.ID_NUMBER_FLOAT: case JsonTokenId.ID_STRING: // can not point to type information: hence must be non-typed (int/double) return deserialize(jp, ctxt); } return typeDeserializer.deserializeTypedFromScalar(jp, ctxt); } } /* /********************************************************** /* And then bit more complicated (but non-structured) number /* types /********************************************************** */ /** * This is bit trickier to implement efficiently, while avoiding * overflow problems. */ @SuppressWarnings("serial") @JacksonStdImpl public static class BigIntegerDeserializer extends StdScalarDeserializer<BigInteger> { public final static BigIntegerDeserializer instance = new BigIntegerDeserializer(); public BigIntegerDeserializer() { super(BigInteger.class); } @SuppressWarnings("incomplete-switch") @Override public

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS> BigInteger deserialize(JsonParser p, DeserializationContext ctxt) throws IOException { switch (p.getCurrentTokenId()) { case JsonTokenId.ID_NUMBER_INT: switch (p.getNumberType()) { case INT: case LONG: case BIG_INTEGER: return p.getBigIntegerValue(); } break; case JsonTokenId.ID_NUMBER_FLOAT: if (!ctxt.isEnabled(DeserializationFeature.ACCEPT_FLOAT_AS_INT)) { _failDoubleToIntCoercion(p, ctxt, "java.math.BigInteger"); } return p.getDecimalValue().toBigInteger(); case JsonTokenId.ID_START_ARRAY: if (ctxt.isEnabled(DeserializationFeature.UNWRAP_SINGLE_VALUE_ARRAYS)) { p.nextToken(); final BigInteger value = deserialize(p, ctxt); if (p.nextToken() != JsonToken.END_ARRAY) { throw ctxt.wrongTokenException(p, JsonToken.END_ARRAY, "Attempted to unwrap single value array for single 'BigInteger' value but there was more than a single value in the array" ); } return value; } break; case JsonTokenId.ID_STRING: // let's do implicit re-parse String text = p.getText().trim(); if (text.length() == 0) { return null; } try { return new BigInteger(text); } catch (IllegalArgumentException iae) { throw ctxt.weirdStringException(text, _valueClass, "not a valid representation"); } } // String is ok too, can easily convert; otherwise, no can do: throw ctxt.mappingException(_valueClass, p.getCurrentToken()); } } @SuppressWarnings("serial") @JacksonStdImpl public static class BigDecimalDeserializer extends StdScalarDeserializer<BigDecimal> { public final static BigDecimalDeserializer instance = new BigDecimalDeserializer(); public BigDecimalDeserializer() { super(BigDecimal.class); } @Override public BigDecimal deserialize(JsonParser p, DeserializationContext ctxt) throws IOException { switch (p.getCurrentTokenId()) { case JsonTokenId.ID_NUMBER_INT: case JsonTokenId.ID_NUMBER_FLOAT: return p.getDecimalValue(); case JsonTokenId.

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS>ID_STRING: String text = p.getText().trim(); if (text.length() == 0) { return null; } try { return new BigDecimal(text); } catch (IllegalArgumentException iae) { throw ctxt.weirdStringException(text, _valueClass, "not a valid representation"); } case JsonTokenId.ID_START_ARRAY: if (ctxt.isEnabled(DeserializationFeature.UNWRAP_SINGLE_VALUE_ARRAYS)) { p.nextToken(); final BigDecimal value = deserialize(p, ctxt); if (p.nextToken() != JsonToken.END_ARRAY) { throw ctxt.wrongTokenException(p, JsonToken.END_ARRAY, "Attempted to unwrap single value array for single 'BigDecimal' value but there was more than a single value in the array" ); } return value; } break; } // Otherwise, no can do: throw ctxt.mappingException(_valueClass, p.getCurrentToken()); } } }

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS>package com.fasterxml.jackson.databind.node; import java.io.IOException; import com.fasterxml.jackson.core.*; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.JsonSerializable; import com.fasterxml.jackson.databind.SerializerProvider; import com.fasterxml.jackson.databind.jsontype.TypeSerializer; /** * Abstract base class common to all standard {@link JsonNode} * implementations. * The main addition here is that we declare that sub-classes must * implement {@link JsonSerializable}. * This simplifies object mapping aspects a bit, as no external serializers are needed. */ public abstract class BaseJsonNode extends JsonNode implements JsonSerializable { protected BaseJsonNode() { } /* /********************************************************** /* Basic definitions for non-container types /********************************************************** */ @Override public final JsonNode findPath(String fieldName) { JsonNode value = findValue(fieldName); if (value == null) { return MissingNode.getInstance(); } return value; } // Also, force (re)definition (2.7) @Override public abstract int hashCode(); /* /********************************************************** /* Support for traversal-as-stream /********************************************************** */ @Override public JsonParser traverse() { return new TreeTraversingParser(this); } @Override public JsonParser traverse(ObjectCodec codec) { return new TreeTraversingParser(this, codec); } /** * Method that can be used for efficient type detection * when using stream abstraction for traversing nodes. * Will return the first {@link JsonToken} that equivalent * stream event would produce (for most nodes there is just * one token but for structured/container types multiple) */ @Override public abstract JsonToken asToken(); /** * Returns code that identifies type of underlying numeric * value, if (and only if) node is a number node. */ @Override public JsonParser.NumberType numberType() { // most types non-numeric, so: return null; } /* /********************************************************** /* JsonSerializable /********************************************************** */ /** * Method called to serialize node instances using given generator. */ @Override public abstract void serialize(Json

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS>package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.util.HashSet; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.core.JsonToken; import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.util.NameTransformer; /** * Variant of {@link BeanDeserializer} used for handling deserialization * of POJOs when serialized as JSON Arrays, instead of JSON Objects. * * @since 2.1 */ public class BeanAsArrayDeserializer extends BeanDeserializerBase { private static final long serialVersionUID = 1L; /** * Deserializer we delegate operations that we can not handle. */ protected final BeanDeserializerBase _delegate; /** * Properties in order expected to be found in JSON array. */ protected final SettableBeanProperty[] _orderedProperties; /* /********************************************************** /* Life-cycle, construction, initialization /********************************************************** */ /** * Main constructor used both for creating new instances (by * {@link BeanDeserializer#asArrayDeserializer}) and for * creating copies with different delegate. */ public BeanAsArrayDeserializer(BeanDeserializerBase delegate, SettableBeanProperty[] ordered) { super(delegate); _delegate = delegate; _orderedProperties = ordered; } @Override public JsonDeserializer<Object> unwrappingDeserializer(NameTransformer unwrapper) { /* We can't do much about this; could either replace _delegate * with unwrapping instance, or just replace this one. Latter seems * more sensible. */ return _delegate.unwrappingDeserializer(unwrapper); } @Override public BeanAsArrayDeserializer withObjectIdReader(ObjectIdReader oir) { return new BeanAsArrayDeserializer(_delegate.withObjectIdReader(oir), _orderedProperties); } @Override public BeanAsArrayDeserializer withIgnorableProperties(HashSet<String> ignorableProps) { return new BeanAsArrayDeserializer(_delegate.withIgnorableProperties(ignorableProps), _orderedProperties); } @Override protected BeanDeserializerBase asArrayDeserializer() { return this; } /* /**********************************************************

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS> /* JsonDeserializer implementation /********************************************************** */ @Override public Object deserialize(JsonParser p, DeserializationContext ctxt) throws IOException { // Let's delegate just in case we got a JSON Object (could error out, alternatively?) if (!p.isExpectedStartArrayToken()) { return _deserializeFromNonArray(p, ctxt); } if (!_vanillaProcessing) { return _deserializeNonVanilla(p, ctxt); } final Object bean = _valueInstantiator.createUsingDefault(ctxt); // [databind#631]: Assign current value, to be accessible by custom serializers p.setCurrentValue(bean); final SettableBeanProperty[] props = _orderedProperties; int i = 0; final int propCount = props.length; while (true) { if (p.nextToken() == JsonToken.END_ARRAY) { return bean; } if (i == propCount) { break; } SettableBeanProperty prop = props[i]; if (prop != null) { // normal case try { prop.deserializeAndSet(p, ctxt, bean); } catch (Exception e) { wrapAndThrow(e, bean, prop.getName(), ctxt); } } else { // just skip? p.skipChildren(); } ++i; } // Ok; extra fields? Let's fail, unless ignoring extra props is fine if (!_ignoreAllUnknown) { throw ctxt.mappingException("Unexpected JSON values; expected at most %d properties (in JSON Array)", propCount); } // otherwise, skip until end while (p.nextToken() != JsonToken.END_ARRAY) { p.skipChildren(); } return bean; } @Override public Object deserialize(JsonParser p, DeserializationContext ctxt, Object bean) throws IOException { // [databind#631]: Assign current value, to be accessible by custom serializers p.setCurrentValue(bean); /* No good way to verify that we have an array... although could I guess * check via JsonParser. So let's assume everything is working fine, for now. */ if (_injectables != null) { injectValues(ctxt, bean); } final SettableBeanProperty[] props =

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS> _orderedProperties; int i = 0; final int propCount = props.length; while (true) { if (p.nextToken() == JsonToken.END_ARRAY) { return bean; } if (i == propCount) { break; } SettableBeanProperty prop = props[i]; if (prop != null) { // normal case try { prop.deserializeAndSet(p, ctxt, bean); } catch (Exception e) { wrapAndThrow(e, bean, prop.getName(), ctxt); } } else { // just skip? p.skipChildren(); } ++i; } // Ok; extra fields? Let's fail, unless ignoring extra props is fine if (!_ignoreAllUnknown) { throw ctxt.mappingException("Unexpected JSON values; expected at most %d properties (in JSON Array)", propCount); } // otherwise, skip until end while (p.nextToken() != JsonToken.END_ARRAY) { p.skipChildren(); } return bean; } // needed since 2.1 @Override public Object deserializeFromObject(JsonParser p, DeserializationContext ctxt) throws IOException { return _deserializeFromNonArray(p, ctxt); } /* /********************************************************** /* Helper methods, non-standard creation /********************************************************** */ /** * Alternate deserialization method that has to check many more configuration * aspects than the "vanilla" processing. */ protected Object _deserializeNonVanilla(JsonParser p, DeserializationContext ctxt) throws IOException { if (_nonStandardCreation) { return _deserializeWithCreator(p, ctxt); } final Object bean = _valueInstantiator.createUsingDefault(ctxt); // [databind#631]: Assign current value, to be accessible by custom serializers p.setCurrentValue(bean); if (_injectables != null) { injectValues(ctxt, bean); } Class<?> activeView = _needViewProcesing ? ctxt.getActiveView() : null; final SettableBeanProperty[] props = _orderedProperties; int i = 0; final int propCount = props.length; while (true) { if (p.nextToken() == JsonToken.END_

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS>ARRAY) { return bean; } if (i == propCount) { break; } SettableBeanProperty prop = props[i]; ++i; if (prop != null) { // normal case if (activeView == null || prop.visibleInView(activeView)) { try { prop.deserializeAndSet(p, ctxt, bean); } catch (Exception e) { wrapAndThrow(e, bean, prop.getName(), ctxt); } continue; } } // otherwise, skip it (view-filtered, no prop etc) p.skipChildren(); } // Ok; extra fields? Let's fail, unless ignoring extra props is fine if (!_ignoreAllUnknown) { throw ctxt.mappingException("Unexpected JSON values; expected at most %d properties (in JSON Array)", propCount); } // otherwise, skip until end while (p.nextToken() != JsonToken.END_ARRAY) { p.skipChildren(); } return bean; } protected Object _deserializeWithCreator(JsonParser p, DeserializationContext ctxt) throws IOException { if (_delegateDeserializer != null) { return _valueInstantiator.createUsingDelegate(ctxt, _delegateDeserializer.deserialize(p, ctxt)); } if (_propertyBasedCreator != null) { return _deserializeUsingPropertyBased(p, ctxt); } // should only occur for abstract types... if (_beanType.isAbstract()) { throw JsonMappingException.from(p, "Can not instantiate abstract type "+_beanType +" (need to add/enable type information?)"); } throw JsonMappingException.from(p, "No suitable constructor found for type " +_beanType+": can not instantiate from JSON object (need to add/enable type information?)"); } /** * Method called to deserialize bean using "property-based creator": * this means that a non-default constructor or factory method is * called, and then possibly other setters. The trick is that * values for creator method need to be buffered, first; and * due to non-guaranteed ordering possibly some other properties * as well. */ @Override protected final Object _deserializeUsingPropertyBased(final JsonParser p, final DeserializationContext ctxt) throws

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS> IOException { final PropertyBasedCreator creator = _propertyBasedCreator; PropertyValueBuffer buffer = creator.startBuilding(p, ctxt, _objectIdReader); final SettableBeanProperty[] props = _orderedProperties; final int propCount = props.length; int i = 0; Object bean = null; for (; p.nextToken() != JsonToken.END_ARRAY; ++i) { SettableBeanProperty prop = (i < propCount) ? props[i] : null; if (prop == null) { // we get null if there are extra elements; maybe otherwise too? p.skipChildren(); continue; } // if we have already constructed POJO, things are simple: if (bean != null) { try { prop.deserializeAndSet(p, ctxt, bean); } catch (Exception e) { wrapAndThrow(e, bean, prop.getName(), ctxt); } continue; } final String propName = prop.getName(); // if not yet, maybe we got a creator property? SettableBeanProperty creatorProp = creator.findCreatorProperty(propName); if (creatorProp != null) { // Last creator property to set? if (buffer.assignParameter(creatorProp, creatorProp.deserialize(p, ctxt))) { try { bean = creator.build(ctxt, buffer); } catch (Exception e) { wrapAndThrow(e, _beanType.getRawClass(), propName, ctxt); continue; // never gets here } // [databind#631]: Assign current value, to be accessible by custom serializers p.setCurrentValue(bean); // polymorphic? if (bean.getClass() != _beanType.getRawClass()) { /* 23-Jul-2012, tatu: Not sure if these could ever be properly * supported (since ordering of elements may not be guaranteed); * but make explicitly non-supported for now. */ throw ctxt.mappingException("Can not support implicit polymorphic deserialization for POJOs-as-Arrays style: " +"nominal type %s, actual type %s", _beanType.getRawClass().getName(), bean.getClass().getName()); } } continue; } // Object Id property?

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS>package com.fasterxml.jackson.databind.node; import java.io.IOException; import java.math.BigDecimal; import java.math.BigInteger; import com.fasterxml.jackson.core.*; import com.fasterxml.jackson.databind.SerializerProvider; /** * Numeric node that contains simple 64-bit integer values. */ public class BigIntegerNode extends NumericNode { private final static BigInteger MIN_INTEGER = BigInteger.valueOf(Integer.MIN_VALUE); private final static BigInteger MAX_INTEGER = BigInteger.valueOf(Integer.MAX_VALUE); private final static BigInteger MIN_LONG = BigInteger.valueOf(Long.MIN_VALUE); private final static BigInteger MAX_LONG = BigInteger.valueOf(Long.MAX_VALUE); final protected BigInteger _value; /* /********************************************************** /* Construction /********************************************************** */ public BigIntegerNode(BigInteger v) { _value = v; } public static BigIntegerNode valueOf(BigInteger v) { return new BigIntegerNode(v); } /* /********************************************************** /* Overrridden JsonNode methods /********************************************************** */ @Override public JsonToken asToken() { return JsonToken.VALUE_NUMBER_INT; } @Override public JsonParser.NumberType numberType() { return JsonParser.NumberType.BIG_INTEGER; } @Override public boolean isIntegralNumber() { return true; } @Override public boolean isBigInteger() { return true; } @Override public boolean canConvertToInt() { return (_value.compareTo(MIN_INTEGER) >= 0) && (_value.compareTo(MAX_INTEGER) <= 0); } @Override public boolean canConvertToLong() { return (_value.compareTo(MIN_LONG) >= 0) && (_value.compareTo(MAX_LONG) <= 0); } @Override public Number numberValue() { return _value; } @Override public short shortValue() { return _value.shortValue(); } @Override public int intValue() { return _value.intValue(); } @Override public long longValue() { return _value.longValue(); } @Override public BigInteger bigIntegerValue() { return _value; } @Override public float floatValue() { return _value.floatValue(); } @Override public double

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS> Collection Boolean unwrapSingle = findFormatFeature(ctxt, property, Collection.class, JsonFormat.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY); // also, often value deserializer is resolved here: JsonDeserializer<?> valueDeser = _valueDeserializer; // May have a content converter valueDeser = findConvertingContentDeserializer(ctxt, property, valueDeser); final JavaType vt = _collectionType.getContentType(); if (valueDeser == null) { valueDeser = ctxt.findContextualValueDeserializer(vt, property); } else { // if directly assigned, probably not yet contextual, so: valueDeser = ctxt.handleSecondaryContextualization(valueDeser, property, vt); } // and finally, type deserializer needs context as well TypeDeserializer valueTypeDeser = _valueTypeDeserializer; if (valueTypeDeser != null) { valueTypeDeser = valueTypeDeser.forProperty(property); } return withResolved(delegateDeser, valueDeser, valueTypeDeser, unwrapSingle); } /* /********************************************************** /* ContainerDeserializerBase API /********************************************************** */ @Override public JavaType getContentType() { return _collectionType.getContentType(); } @Override public JsonDeserializer<Object> getContentDeserializer() { return _valueDeserializer; } /* /********************************************************** /* JsonDeserializer API /********************************************************** */ @SuppressWarnings("unchecked") @Override public Collection<Object> deserialize(JsonParser p, DeserializationContext ctxt) throws IOException { if (_delegateDeserializer != null) { return (Collection<Object>) _valueInstantiator.createUsingDelegate(ctxt, _delegateDeserializer.deserialize(p, ctxt)); } /* [JACKSON-620]: empty String may be ok; bit tricky to check, however, since * there is also possibility of "auto-wrapping" of single-element arrays. * Hence we only accept empty String here. */ if (p.hasToken(JsonToken.VALUE_STRING)) { String str = p.getText(); if (str.length() == 0) { return (Collection<Object>) _valueInstantiator.createFromString(ctxt, str); } } return deserialize(

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS>p, ctxt, (Collection<Object>) _valueInstantiator.createUsingDefault(ctxt)); } @Override public Collection<Object> deserialize(JsonParser p, DeserializationContext ctxt, Collection<Object> result) throws IOException { // Ok: must point to START_ARRAY (or equivalent) if (!p.isExpectedStartArrayToken()) { return handleNonArray(p, ctxt, result); } // [databind#631]: Assign current value, to be accessible by custom serializers p.setCurrentValue(result); JsonDeserializer<Object> valueDes = _valueDeserializer; final TypeDeserializer typeDeser = _valueTypeDeserializer; CollectionReferringAccumulator referringAccumulator = (valueDes.getObjectIdReader() == null) ? null : new CollectionReferringAccumulator(_collectionType.getContentType().getRawClass(), result); JsonToken t; while ((t = p.nextToken()) != JsonToken.END_ARRAY) { try { Object value; if (t == JsonToken.VALUE_NULL) { value = valueDes.getNullValue(ctxt); } else if (typeDeser == null) { value = valueDes.deserialize(p, ctxt); } else { value = valueDes.deserializeWithType(p, ctxt, typeDeser); } if (referringAccumulator != null) { referringAccumulator.add(value); } else { result.add(value); } } catch (UnresolvedForwardReference reference) { if (referringAccumulator == null) { throw JsonMappingException .from(p, "Unresolved forward reference but no identity info", reference); } Referring ref = referringAccumulator.handleUnresolvedReference(reference); reference.getRoid().appendReferring(ref); } catch (Exception e) { boolean wrap = (ctxt == null) || ctxt.isEnabled(DeserializationFeature.WRAP_EXCEPTIONS); if (!wrap && e instanceof RuntimeException) { throw (RuntimeException)e; } throw JsonMappingException.wrapWithPath(e, result, result.size()); } } return result; } @Override public Object deserializeWithType(JsonParser jp, DeserializationContext ctxt, TypeDeserializer typeDeserializer) throws IOException { // In future could check current token... for now

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS> this should be enough: return typeDeserializer.deserializeTypedFromArray(jp, ctxt); } /** * Helper method called when current token is no START_ARRAY. Will either * throw an exception, or try to handle value as if member of implicit * array, depending on configuration. */ protected final Collection<Object> handleNonArray(JsonParser p, DeserializationContext ctxt, Collection<Object> result) throws IOException { // Implicit arrays from single values? boolean canWrap = (_unwrapSingle == Boolean.TRUE) || ((_unwrapSingle == null) && ctxt.isEnabled(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY)); if (!canWrap) { throw ctxt.mappingException(_collectionType.getRawClass()); } JsonDeserializer<Object> valueDes = _valueDeserializer; final TypeDeserializer typeDeser = _valueTypeDeserializer; JsonToken t = p.getCurrentToken(); Object value; try { if (t == JsonToken.VALUE_NULL) { value = valueDes.getNullValue(ctxt); } else if (typeDeser == null) { value = valueDes.deserialize(p, ctxt); } else { value = valueDes.deserializeWithType(p, ctxt, typeDeser); } } catch (Exception e) { // note: pass Object.class, not Object[].class, as we need element type for error info throw JsonMappingException.wrapWithPath(e, Object.class, result.size()); } result.add(value); return result; } public final static class CollectionReferringAccumulator { private final Class<?> _elementType; private final Collection<Object> _result; /** * A list of {@link CollectionReferring} to maintain ordering. */ private List<CollectionReferring> _accumulator = new ArrayList<CollectionReferring>(); public CollectionReferringAccumulator(Class<?> elementType, Collection<Object> result) { _elementType = elementType; _result = result; } public void add(Object value) { if (_accumulator.isEmpty()) { _result.add(value); } else { CollectionReferring ref = _accumulator.get(_accumulator.size() - 1); ref.next.add(value); } } public

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS>package com.fasterxml.jackson.databind.node; import java.io.IOException; import com.fasterxml.jackson.core.*; import com.fasterxml.jackson.databind.JsonSerializable; import com.fasterxml.jackson.databind.SerializerProvider; import com.fasterxml.jackson.databind.util.RawValue; /** * Value node that contains a wrapped POJO, to be serialized as * a JSON constructed through data mapping (usually done by * calling {@link com.fasterxml.jackson.databind.ObjectMapper}). */ public class POJONode extends ValueNode { protected final Object _value; public POJONode(Object v) { _value = v; } /* /********************************************************** /* Base class overrides /********************************************************** */ @Override public JsonNodeType getNodeType() { return JsonNodeType.POJO; } @Override public JsonToken asToken() { return JsonToken.VALUE_EMBEDDED_OBJECT; } /** * As it is possible that some implementations embed byte[] as POJONode * (despite optimal being {@link BinaryNode}), let's add support for exposing * binary data here too. */ @Override public byte[] binaryValue() throws IOException { if (_value instanceof byte[]) { return (byte[]) _value; } return super.binaryValue(); } /* /********************************************************** /* General type coercions /********************************************************** */ @Override public String asText() { return (_value == null) ? "null" : _value.toString(); } @Override public String asText(String defaultValue) { return (_value == null) ? defaultValue : _value.toString(); } @Override public boolean asBoolean(boolean defaultValue) { if (_value != null && _value instanceof Boolean) { return ((Boolean) _value).booleanValue(); } return defaultValue; } @Override public int asInt(int defaultValue) { if (_value instanceof Number) { return ((Number) _value).intValue(); } return defaultValue; } @Override public long asLong(long defaultValue) { if (_value instanceof Number) { return ((Number) _value).longValue(); } return defaultValue; } @Override public

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS>.forProperty(property); } return withResolved(elemTypeDeser, deser, unwrapSingle); } @Override // since 2.5 public boolean isCachable() { // Important: do NOT cache if polymorphic values, or ones with custom deserializer return (_elementDeserializer == null) && (_elementTypeDeserializer == null); } /* /********************************************************** /* ContainerDeserializerBase API /********************************************************** */ @Override public JavaType getContentType() { return _arrayType.getContentType(); } @Override public JsonDeserializer<Object> getContentDeserializer() { return _elementDeserializer; } /* /********************************************************** /* JsonDeserializer API /********************************************************** */ @Override public Object[] deserialize(JsonParser p, DeserializationContext ctxt) throws IOException { // Ok: must point to START_ARRAY (or equivalent) if (!p.isExpectedStartArrayToken()) { return handleNonArray(p, ctxt); } final ObjectBuffer buffer = ctxt.leaseObjectBuffer(); Object[] chunk = buffer.resetAndStart(); int ix = 0; JsonToken t; final TypeDeserializer typeDeser = _elementTypeDeserializer; try { while ((t = p.nextToken()) != JsonToken.END_ARRAY) { // Note: must handle null explicitly here; value deserializers won't Object value; if (t == JsonToken.VALUE_NULL) { value = _elementDeserializer.getNullValue(ctxt); } else if (typeDeser == null) { value = _elementDeserializer.deserialize(p, ctxt); } else { value = _elementDeserializer.deserializeWithType(p, ctxt, typeDeser); } if (ix >= chunk.length) { chunk = buffer.appendCompletedChunk(chunk); ix = 0; } chunk[ix++] = value; } } catch (Exception e) { throw JsonMappingException.wrapWithPath(e, chunk, buffer.bufferedSize() + ix); } Object[] result; if (_untyped) { result = buffer.completeAndClearBuffer(chunk, ix); } else { result = buffer.completeAndClearBuffer(chunk, ix, _elementClass); } ctxt.returnObjectBuffer(buffer

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS>); return result; } @Override public Object[] deserializeWithType(JsonParser p, DeserializationContext ctxt, TypeDeserializer typeDeserializer) throws IOException { /* Should there be separate handling for base64 stuff? * for now this should be enough: */ return (Object[]) typeDeserializer.deserializeTypedFromArray(p, ctxt); } /* /********************************************************** /* Internal methods /********************************************************** */ protected Byte[] deserializeFromBase64(JsonParser p, DeserializationContext ctxt) throws IOException { // First same as what PrimitiveArrayDeserializers.ByteDeser does: byte[] b = p.getBinaryValue(ctxt.getBase64Variant()); // But then need to convert to wrappers Byte[] result = new Byte[b.length]; for (int i = 0, len = b.length; i < len; ++i) { result[i] = Byte.valueOf(b[i]); } return result; } protected Object[] handleNonArray(JsonParser p, DeserializationContext ctxt) throws IOException { // Empty String can become null... if (p.hasToken(JsonToken.VALUE_STRING) && ctxt.isEnabled(DeserializationFeature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT)) { String str = p.getText(); if (str.length() == 0) { return null; } } // Can we do implicit coercion to a single-element array still? boolean canWrap = (_unwrapSingle == Boolean.TRUE) || ((_unwrapSingle == null) && ctxt.isEnabled(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY)); if (!canWrap) { // One exception; byte arrays are generally serialized as base64, so that should be handled if (p.getCurrentToken() == JsonToken.VALUE_STRING // note: not `byte[]`, but `Byte[]` -- former is primitive array && _elementClass == Byte.class) { return deserializeFromBase64(p, ctxt); } throw ctxt.mappingException(_arrayType.getRawClass()); } JsonToken t = p.getCurrentToken(); Object value; if (t == JsonToken.VALUE_NULL) { value = _elementDeserializer.getNullValue

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS>src, ignorableProps); } @Override public JsonDeserializer<Object> unwrappingDeserializer(NameTransformer unwrapper) { /* bit kludgy but we don't want to accidentally change type; sub-classes * MUST override this method to support unwrapped properties... */ if (getClass() != BeanDeserializer.class) { return this; } /* main thing really is to just enforce ignoring of unknown * properties; since there may be multiple unwrapped values * and properties for all may be interleaved... */ return new BeanDeserializer(this, unwrapper); } @Override public BeanDeserializer withObjectIdReader(ObjectIdReader oir) { return new BeanDeserializer(this, oir); } @Override public BeanDeserializer withIgnorableProperties(HashSet<String> ignorableProps) { return new BeanDeserializer(this, ignorableProps); } @Override protected BeanDeserializerBase asArrayDeserializer() { SettableBeanProperty[] props = _beanProperties.getPropertiesInInsertionOrder(); return new BeanAsArrayDeserializer(this, props); } /* /********************************************************** /* JsonDeserializer implementation /********************************************************** */ /** * Main deserialization method for bean-based objects (POJOs). *<p> * NOTE: was declared 'final' in 2.2; should NOT be to let extensions * like Afterburner change definition. */ @Override public Object deserialize(JsonParser p, DeserializationContext ctxt) throws IOException { // common case first if (p.isExpectedStartObjectToken()) { if (_vanillaProcessing) { return vanillaDeserialize(p, ctxt, p.nextToken()); } // 23-Sep-2015, tatu: This is wrong at some many levels, but for now... it is // what it is, including "expected behavior". p.nextToken(); if (_objectIdReader != null) { return deserializeWithObjectId(p, ctxt); } return deserializeFromObject(p, ctxt); } return _deserializeOther(p, ctxt, p.getCurrentToken()); } protected final Object _deserializeOther(JsonParser p, DeserializationContext ctxt, JsonToken t) throws IOException { // and then others, generally requiring use of @JsonCreator

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS> switch (t) { case VALUE_STRING: return deserializeFromString(p, ctxt); case VALUE_NUMBER_INT: return deserializeFromNumber(p, ctxt); case VALUE_NUMBER_FLOAT: return deserializeFromDouble(p, ctxt); case VALUE_EMBEDDED_OBJECT: return deserializeFromEmbedded(p, ctxt); case VALUE_TRUE: case VALUE_FALSE: return deserializeFromBoolean(p, ctxt); case VALUE_NULL: return deserializeFromNull(p, ctxt); case START_ARRAY: // these only work if there's a (delegating) creator... return deserializeFromArray(p, ctxt); case FIELD_NAME: case END_OBJECT: // added to resolve [JACKSON-319], possible related issues if (_vanillaProcessing) { return vanillaDeserialize(p, ctxt, t); } if (_objectIdReader != null) { return deserializeWithObjectId(p, ctxt); } return deserializeFromObject(p, ctxt); default: } throw ctxt.mappingException(handledType()); } protected Object _missingToken(JsonParser p, DeserializationContext ctxt) throws IOException { throw ctxt.endOfInputException(handledType()); } /** * Secondary deserialization method, called in cases where POJO * instance is created as part of deserialization, potentially * after collecting some or all of the properties to set. */ @Override public Object deserialize(JsonParser p, DeserializationContext ctxt, Object bean) throws IOException { // [databind#631]: Assign current value, to be accessible by custom serializers p.setCurrentValue(bean); if (_injectables != null) { injectValues(ctxt, bean); } if (_unwrappedPropertyHandler != null) { return deserializeWithUnwrapped(p, ctxt, bean); } if (_externalTypeIdHandler != null) { return deserializeWithExternalTypeId(p, ctxt, bean); } String propName; // 23-Mar-2010, tatu: In some cases, we start with full JSON object too... if (p.isExpectedStartObjectToken()) { propName = p.nextFieldName(); if (propName == null) { return bean; } }

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS> else { if (p.hasTokenId(JsonTokenId.ID_FIELD_NAME)) { propName = p.getCurrentName(); } else { return bean; } } if (_needViewProcesing) { Class<?> view = ctxt.getActiveView(); if (view != null) { return deserializeWithView(p, ctxt, bean, view); } } do { p.nextToken(); SettableBeanProperty prop = _beanProperties.find(propName); if (prop != null) { // normal case try { prop.deserializeAndSet(p, ctxt, bean); } catch (Exception e) { wrapAndThrow(e, bean, propName, ctxt); } continue; } handleUnknownVanilla(p, ctxt, bean, propName); } while ((propName = p.nextFieldName()) != null); return bean; } /* /********************************************************** /* Concrete deserialization methods /********************************************************** */ /** * Streamlined version that is only used when no "special" * features are enabled. */ private final Object vanillaDeserialize(JsonParser p, DeserializationContext ctxt, JsonToken t) throws IOException { final Object bean = _valueInstantiator.createUsingDefault(ctxt); // [databind#631]: Assign current value, to be accessible by custom serializers p.setCurrentValue(bean); if (p.hasTokenId(JsonTokenId.ID_FIELD_NAME)) { String propName = p.getCurrentName(); do { p.nextToken(); SettableBeanProperty prop = _beanProperties.find(propName); if (prop != null) { // normal case try { prop.deserializeAndSet(p, ctxt, bean); } catch (Exception e) { wrapAndThrow(e, bean, propName, ctxt); } continue; } handleUnknownVanilla(p, ctxt, bean, propName); } while ((propName = p.nextFieldName()) != null); } return bean; } /** * General version used when handling needs more advanced features. */ @Override public Object deserializeFromObject(JsonParser p, DeserializationContext ctxt) throws IOException { /* 09-Dec-

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS> return deserializeWithView(p, ctxt, bean, view); } } if (p.hasTokenId(JsonTokenId.ID_FIELD_NAME)) { String propName = p.getCurrentName(); do { p.nextToken(); SettableBeanProperty prop = _beanProperties.find(propName); if (prop != null) { // normal case try { prop.deserializeAndSet(p, ctxt, bean); } catch (Exception e) { wrapAndThrow(e, bean, propName, ctxt); } continue; } handleUnknownVanilla(p, ctxt, bean, propName); } while ((propName = p.nextFieldName()) != null); } return bean; } /** * Method called to deserialize bean using "property-based creator": * this means that a non-default constructor or factory method is * called, and then possibly other setters. The trick is that * values for creator method need to be buffered, first; and * due to non-guaranteed ordering possibly some other properties * as well. */ @Override @SuppressWarnings("resource") protected Object _deserializeUsingPropertyBased(final JsonParser p, final DeserializationContext ctxt) throws IOException { final PropertyBasedCreator creator = _propertyBasedCreator; PropertyValueBuffer buffer = creator.startBuilding(p, ctxt, _objectIdReader); // 04-Jan-2010, tatu: May need to collect unknown properties for polymorphic cases TokenBuffer unknown = null; JsonToken t = p.getCurrentToken(); for (; t == JsonToken.FIELD_NAME; t = p.nextToken()) { String propName = p.getCurrentName(); p.nextToken(); // to point to value // creator property? SettableBeanProperty creatorProp = creator.findCreatorProperty(propName); if (creatorProp != null) { // Last creator property to set? if (buffer.assignParameter(creatorProp, _deserializeWithErrorWrapping(p, ctxt, creatorProp))) { p.nextToken(); // to move to following FIELD_NAME/END_OBJECT Object bean; try { bean = creator.build(ctxt, buffer); } catch (Exception e) { wrapInstantiationProblem(e, ctxt);

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS>ymorphic? if (bean.getClass() != _beanType.getRawClass()) { return handlePolymorphic(null, ctxt, bean, unknown); } // no, just some extra unknown properties return handleUnknownProperties(ctxt, bean, unknown); } return bean; } protected final Object _deserializeWithErrorWrapping(JsonParser p, DeserializationContext ctxt, SettableBeanProperty prop) throws IOException { try { return prop.deserialize(p, ctxt); } catch (Exception e) { wrapAndThrow(e, _beanType.getRawClass(), prop.getName(), ctxt); // never gets here, unless caller declines to throw an exception return null; } } /** * Helper method called for rare case of pointing to {@link JsonToken#VALUE_NULL} * token. While this is most often an erroneous condition, there is one specific * case with XML handling where polymorphic type with no properties is exposed * as such, and should be handled same as empty Object. * * @since 2.7 */ protected Object deserializeFromNull(JsonParser p, DeserializationContext ctxt) throws IOException { // 17-Dec-2015, tatu: Highly specialized case, mainly to support polymorphic // "empty" POJOs deserialized from XML, where empty XML tag synthesizes a // `VALUE_NULL` token. if (p.requiresCustomCodec()) { // not only XML module, but mostly it... @SuppressWarnings("resource") TokenBuffer tb = new TokenBuffer(p, ctxt); tb.writeEndObject(); JsonParser p2 = tb.asParser(p); p2.nextToken(); // to point to END_OBJECT // note: don't have ObjectId to consider at this point, so: Object ob = _vanillaProcessing ? vanillaDeserialize(p2, ctxt, JsonToken.END_OBJECT) : deserializeFromObject(p2, ctxt); p2.close(); return ob; } throw ctxt.mappingException(handledType()); } /* /********************************************************** /* Deserializing when we have to consider an active View /********************************************************** */ protected final Object deserializeWithView(JsonParser p, DeserializationContext ctxt, Object bean,

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS>propName); if (prop != null) { // normal case if (activeView != null && !prop.visibleInView(activeView)) { p.skipChildren(); continue; } try { prop.deserializeAndSet(p, ctxt, bean); } catch (Exception e) { wrapAndThrow(e, bean, propName, ctxt); } continue; } // Things marked as ignorable should not be passed to any setter if (_ignorableProps != null && _ignorableProps.contains(propName)) { handleIgnoredProperty(p, ctxt, bean, propName); continue; } // but... others should be passed to unwrapped property deserializers tokens.writeFieldName(propName); tokens.copyCurrentStructure(p); // how about any setter? We'll get copies but... if (_anySetter != null) { try { _anySetter.deserializeAndSet(p, ctxt, bean, propName); } catch (Exception e) { wrapAndThrow(e, bean, propName, ctxt); } continue; } } tokens.writeEndObject(); _unwrappedPropertyHandler.processUnwrapped(p, ctxt, bean, tokens); return bean; } @SuppressWarnings("resource") protected Object deserializeWithUnwrapped(JsonParser p, DeserializationContext ctxt, Object bean) throws IOException { JsonToken t = p.getCurrentToken(); if (t == JsonToken.START_OBJECT) { t = p.nextToken(); } TokenBuffer tokens = new TokenBuffer(p, ctxt); tokens.writeStartObject(); final Class<?> activeView = _needViewProcesing ? ctxt.getActiveView() : null; for (; t == JsonToken.FIELD_NAME; t = p.nextToken()) { String propName = p.getCurrentName(); SettableBeanProperty prop = _beanProperties.find(propName); p.nextToken(); if (prop != null) { // normal case if (activeView != null && !prop.visibleInView(activeView)) { p.skipChildren(); continue; } try { prop.deserializeAndSet(p, ctxt, bean); } catch (Exception e) { wrapAndThrow(e, bean, propName,

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS> ctxt); } continue; } if (_ignorableProps != null && _ignorableProps.contains(propName)) { handleIgnoredProperty(p, ctxt, bean, propName); continue; } // but... others should be passed to unwrapped property deserializers tokens.writeFieldName(propName); tokens.copyCurrentStructure(p); // how about any setter? We'll get copies but... if (_anySetter != null) { _anySetter.deserializeAndSet(p, ctxt, bean, propName); } } tokens.writeEndObject(); _unwrappedPropertyHandler.processUnwrapped(p, ctxt, bean, tokens); return bean; } @SuppressWarnings("resource") protected Object deserializeUsingPropertyBasedWithUnwrapped(JsonParser p, DeserializationContext ctxt) throws IOException { final PropertyBasedCreator creator = _propertyBasedCreator; PropertyValueBuffer buffer = creator.startBuilding(p, ctxt, _objectIdReader); TokenBuffer tokens = new TokenBuffer(p, ctxt); tokens.writeStartObject(); JsonToken t = p.getCurrentToken(); for (; t == JsonToken.FIELD_NAME; t = p.nextToken()) { String propName = p.getCurrentName(); p.nextToken(); // to point to value // creator property? SettableBeanProperty creatorProp = creator.findCreatorProperty(propName); if (creatorProp != null) { // Last creator property to set? if (buffer.assignParameter(creatorProp, _deserializeWithErrorWrapping(p, ctxt, creatorProp))) { t = p.nextToken(); // to move to following FIELD_NAME/END_OBJECT Object bean; try { bean = creator.build(ctxt, buffer); } catch (Exception e) { wrapInstantiationProblem(e, ctxt); continue; // never gets here } // [databind#631]: Assign current value, to be accessible by custom serializers p.setCurrentValue(bean); // if so, need to copy all remaining tokens into buffer while (t == JsonToken.FIELD_NAME) { p.nextToken(); // to skip name tokens.copyCurrentStructure(p); t = p.nextToken(); } tokens.writeEndObject(); if (bean.getClass() != _

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS>, and basically * external type id handling just has to be ignored, as they would relate to target * type and not delegate type. Whether this works as expected is another story, but * there's no other way to really mix these conflicting features. */ return _valueInstantiator.createUsingDelegate(ctxt, _delegateDeserializer.deserialize(p, ctxt)); } return deserializeWithExternalTypeId(p, ctxt, _valueInstantiator.createUsingDefault(ctxt)); } protected Object deserializeWithExternalTypeId(JsonParser p, DeserializationContext ctxt, Object bean) throws IOException { final Class<?> activeView = _needViewProcesing ? ctxt.getActiveView() : null; final ExternalTypeHandler ext = _externalTypeIdHandler.start(); for (JsonToken t = p.getCurrentToken(); t == JsonToken.FIELD_NAME; t = p.nextToken()) { String propName = p.getCurrentName(); t = p.nextToken(); SettableBeanProperty prop = _beanProperties.find(propName); if (prop != null) { // normal case // [JACKSON-831]: may have property AND be used as external type id: if (t.isScalarValue()) { ext.handleTypePropertyValue(p, ctxt, propName, bean); } if (activeView != null && !prop.visibleInView(activeView)) { p.skipChildren(); continue; } try { prop.deserializeAndSet(p, ctxt, bean); } catch (Exception e) { wrapAndThrow(e, bean, propName, ctxt); } continue; } // ignorable things should be ignored if (_ignorableProps != null && _ignorableProps.contains(propName)) { handleIgnoredProperty(p, ctxt, bean, propName); continue; } // but others are likely to be part of external type id thingy... if (ext.handlePropertyValue(p, ctxt, propName, bean)) { continue; } // if not, the usual fallback handling: if (_anySetter != null) { try { _anySetter.deserializeAndSet(p, ctxt, bean, propName); } catch (Exception e) { wrapAndThrow(e, bean,

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS> propName, ctxt); } continue; } // Unknown: let's call handler method handleUnknownProperty(p, ctxt, bean, propName); } // and when we get this far, let's try finalizing the deal: return ext.complete(p, ctxt, bean); } @SuppressWarnings("resource") protected Object deserializeUsingPropertyBasedWithExternalTypeId(JsonParser p, DeserializationContext ctxt) throws IOException { final ExternalTypeHandler ext = _externalTypeIdHandler.start(); final PropertyBasedCreator creator = _propertyBasedCreator; PropertyValueBuffer buffer = creator.startBuilding(p, ctxt, _objectIdReader); TokenBuffer tokens = new TokenBuffer(p, ctxt); tokens.writeStartObject(); JsonToken t = p.getCurrentToken(); for (; t == JsonToken.FIELD_NAME; t = p.nextToken()) { String propName = p.getCurrentName(); p.nextToken(); // to point to value // creator property? SettableBeanProperty creatorProp = creator.findCreatorProperty(propName); if (creatorProp != null) { // first: let's check to see if this might be part of value with external type id: // 11-Sep-2015, tatu: Important; do NOT pass buffer as last arg, but null, // since it is not the bean if (ext.handlePropertyValue(p, ctxt, propName, null)) { ; } else { // Last creator property to set? if (buffer.assignParameter(creatorProp, _deserializeWithErrorWrapping(p, ctxt, creatorProp))) { t = p.nextToken(); // to move to following FIELD_NAME/END_OBJECT Object bean; try { bean = creator.build(ctxt, buffer); } catch (Exception e) { wrapAndThrow(e, _beanType.getRawClass(), propName, ctxt); continue; // never gets here } // if so, need to copy all remaining tokens into buffer while (t == JsonToken.FIELD_NAME) { p.nextToken(); // to skip name tokens.copyCurrentStructure(p); t = p.nextToken(); } if (bean.getClass() != _beanType.getRawClass()) { // !!! 08

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS> } /* /********************************************************** /* Methods sub-classes may choose to override, if customized /* initialization is needed. /********************************************************** */ /** * NOTE: changed from static to non-static in 2.5; unfortunate but * necessary change to support overridability */ protected JsonToken _initForReading(JsonParser p) throws IOException { if (_schema != null) { p.setSchema(_schema); } _config.initialize(p); // since 2.5 /* First: must point to a token; if not pointing to one, advance. * This occurs before first read from JsonParser, as well as * after clearing of current token. */ JsonToken t = p.getCurrentToken(); if (t == null) { // and then we must get something... t = p.nextToken(); if (t == null) { // Throw mapping exception, since it's failure to map, not an actual parsing problem throw JsonMappingException.from(p, "No content to map due to end-of-input"); } } return t; } /** * Alternative to {@link #_initForReading(JsonParser)} used in cases where reading * of multiple values means that we may or may not want to advance the stream, * but need to do other initialization. *<p> * Base implementation only sets configured {@link FormatSchema}, if any, on parser. * * @since 2.5 */ protected void _initForMultiRead(JsonParser p) throws IOException { if (_schema != null) { p.setSchema(_schema); } _config.initialize(p); // since 2.5 } /* /********************************************************** /* Life-cycle, fluent factory methods for DeserializationFeatures /********************************************************** */ /** * Method for constructing a new reader instance that is configured * with specified feature enabled. */ public ObjectReader with(DeserializationFeature feature) { return _with(_config.with(feature)); } /** * Method for constructing a new reader instance that is configured * with specified features enabled. */ public ObjectReader with(DeserializationFeature first, DeserializationFeature... other) { return _with(_config.with(first

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS> #readValue(InputStream)}. */ public <T> MappingIterator<T> readValues(File src) throws IOException, JsonProcessingException { if (_dataFormatReaders != null) { return _detectBindAndReadValues( _dataFormatReaders.findFormat(_inputStream(src)), false); } return _bindAndReadValues(_considerFilter(_parserFactory.createParser(src))); } /** * Overloaded version of {@link #readValue(InputStream)}. * * @param src URL to read to access JSON content to parse. */ public <T> MappingIterator<T> readValues(URL src) throws IOException, JsonProcessingException { if (_dataFormatReaders != null) { return _detectBindAndReadValues( _dataFormatReaders.findFormat(_inputStream(src)), true); } return _bindAndReadValues(_considerFilter(_parserFactory.createParser(src))); } /* /********************************************************** /* Implementation of rest of ObjectCodec methods /********************************************************** */ @Override public <T> T treeToValue(TreeNode n, Class<T> valueType) throws JsonProcessingException { try { return readValue(treeAsTokens(n), valueType); } catch (JsonProcessingException e) { throw e; } catch (IOException e) { // should not occur, no real i/o... throw new IllegalArgumentException(e.getMessage(), e); } } @Override public void writeValue(JsonGenerator gen, Object value) throws IOException, JsonProcessingException { throw new UnsupportedOperationException("Not implemented for ObjectReader"); } /* /********************************************************** /* Helper methods, data-binding /********************************************************** */ /** * Actual implementation of value reading+binding operation. */ protected Object _bind(JsonParser p, Object valueToUpdate) throws IOException { /* First: may need to read the next token, to initialize state (either * before first read from parser, or after previous token has been cleared) */ Object result; JsonToken t = _initForReading(p); if (t == JsonToken.VALUE_NULL) { if (valueToUpdate == null) { DeserializationContext ctxt = createDeserializationContext(p); result = _findRootDeserializer(ctxt).get

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS>NullValue(ctxt); } else { result = valueToUpdate; } } else if (t == JsonToken.END_ARRAY || t == JsonToken.END_OBJECT) { result = valueToUpdate; } else { // pointing to event other than null DeserializationContext ctxt = createDeserializationContext(p); JsonDeserializer<Object> deser = _findRootDeserializer(ctxt); if (_unwrapRoot) { result = _unwrapAndDeserialize(p, ctxt, _valueType, deser); } else { if (valueToUpdate == null) { result = deser.deserialize(p, ctxt); } else { deser.deserialize(p, ctxt, valueToUpdate); result = valueToUpdate; } } } // Need to consume the token too p.clearCurrentToken(); return result; } /** * Consider filter when creating JsonParser. */ protected JsonParser _considerFilter(final JsonParser p) { return _filter == null || FilteringParserDelegate.class.isInstance(p) ? p : new FilteringParserDelegate(p, _filter, false, false); } protected Object _bindAndClose(JsonParser p) throws IOException { try { Object result; JsonToken t = _initForReading(p); if (t == JsonToken.VALUE_NULL) { if (_valueToUpdate == null) { DeserializationContext ctxt = createDeserializationContext(p); result = _findRootDeserializer(ctxt).getNullValue(ctxt); } else { result = _valueToUpdate; } } else if (t == JsonToken.END_ARRAY || t == JsonToken.END_OBJECT) { result = _valueToUpdate; } else { DeserializationContext ctxt = createDeserializationContext(p); JsonDeserializer<Object> deser = _findRootDeserializer(ctxt); if (_unwrapRoot) { result = _unwrapAndDeserialize(p, ctxt, _valueType, deser); } else { if (_valueToUpdate == null) { result = deser.deserialize(p, ctxt); } else { deser.deserialize(p, ctxt, _valueToUpdate); result = _valueToUpdate; } } } return result; } finally { try { p.close(); } catch (IOException ioe) {

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS> } } } protected JsonNode _bindAndCloseAsTree(JsonParser p) throws IOException { try { return _bindAsTree(p); } finally { try { p.close(); } catch (IOException ioe) { } } } protected JsonNode _bindAsTree(JsonParser p) throws IOException { JsonNode result; JsonToken t = _initForReading(p); if (t == JsonToken.VALUE_NULL || t == JsonToken.END_ARRAY || t == JsonToken.END_OBJECT) { result = NullNode.instance; } else { DeserializationContext ctxt = createDeserializationContext(p); JsonDeserializer<Object> deser = _findTreeDeserializer(ctxt); if (_unwrapRoot) { result = (JsonNode) _unwrapAndDeserialize(p, ctxt, JSON_NODE_TYPE, deser); } else { result = (JsonNode) deser.deserialize(p, ctxt); } } // Need to consume the token too p.clearCurrentToken(); return result; } /** * @since 2.1 */ protected <T> MappingIterator<T> _bindAndReadValues(JsonParser p) throws IOException { _initForMultiRead(p); p.nextToken(); DeserializationContext ctxt = createDeserializationContext(p); return _newIterator(p, ctxt, _findRootDeserializer(ctxt), true); } protected Object _unwrapAndDeserialize(JsonParser p, DeserializationContext ctxt, JavaType rootType, JsonDeserializer<Object> deser) throws IOException { PropertyName expRootName = _config.findRootName(rootType); // 12-Jun-2015, tatu: Should try to support namespaces etc but... String expSimpleName = expRootName.getSimpleName(); if (p.getCurrentToken() != JsonToken.START_OBJECT) { throw JsonMappingException.from(p, "Current token not START_OBJECT (needed to unwrap root name '" +expSimpleName+"'), but "+p.getCurrentToken()); } if (p.nextToken() != JsonToken.FIELD_NAME) { throw JsonMappingException.from(p, "Current token not FIELD_NAME (to contain expected root name '" +expSimpleName+"'),

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS> but "+p.getCurrentToken()); } String actualName = p.getCurrentName(); if (!expSimpleName.equals(actualName)) { throw JsonMappingException.from(p, "Root name '"+actualName+"' does not match expected ('" +expSimpleName+"') for type "+rootType); } // ok, then move to value itself.... p.nextToken(); Object result; if (_valueToUpdate == null) { result = deser.deserialize(p, ctxt); } else { deser.deserialize(p, ctxt, _valueToUpdate); result = _valueToUpdate; } // and last, verify that we now get matching END_OBJECT if (p.nextToken() != JsonToken.END_OBJECT) { throw JsonMappingException.from(p, "Current token not END_OBJECT (to match wrapper object with root name '" +expSimpleName+"'), but "+p.getCurrentToken()); } return result; } /* /********************************************************** /* Internal methods, format auto-detection /********************************************************** */ @SuppressWarnings("resource") protected Object _detectBindAndClose(byte[] src, int offset, int length) throws IOException { DataFormatReaders.Match match = _dataFormatReaders.findFormat(src, offset, length); if (!match.hasMatch()) { _reportUnkownFormat(_dataFormatReaders, match); } JsonParser p = match.createParserWithMatch(); return match.getReader()._bindAndClose(p); } @SuppressWarnings("resource") protected Object _detectBindAndClose(DataFormatReaders.Match match, boolean forceClosing) throws IOException { if (!match.hasMatch()) { _reportUnkownFormat(_dataFormatReaders, match); } JsonParser p = match.createParserWithMatch(); // One more thing: we Own the input stream now; and while it's // not super clean way to do it, we must ensure closure so: if (forceClosing) { p.enable(JsonParser.Feature.AUTO_CLOSE_SOURCE); } // important: use matching ObjectReader (may not be 'this') return match.getReader()._bindAndClose(p); } @SuppressWarnings("resource")

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS>Type +" (need to add/enable type information?)"); } boolean hasStringCreator = _valueInstantiator.canCreateFromString(); boolean hasDefaultCtor = _valueInstantiator.canCreateUsingDefault(); // and finally, verify we do have single-String arg constructor (if no @JsonCreator) if (!hasStringCreator && !hasDefaultCtor) { throw JsonMappingException.from(p,"Can not deserialize Throwable of type "+_beanType +" without having a default contructor, a single-String-arg constructor; or explicit @JsonCreator"); } Object throwable = null; Object[] pending = null; int pendingIx = 0; for (; p.getCurrentToken() != JsonToken.END_OBJECT; p.nextToken()) { String propName = p.getCurrentName(); SettableBeanProperty prop = _beanProperties.find(propName); p.nextToken(); // to point to field value if (prop != null) { // normal case if (throwable != null) { prop.deserializeAndSet(p, ctxt, throwable); continue; } // nope; need to defer if (pending == null) { int len = _beanProperties.size(); pending = new Object[len + len]; } pending[pendingIx++] = prop; pending[pendingIx++] = prop.deserialize(p, ctxt); continue; } // Maybe it's "message"? if (PROP_NAME_MESSAGE.equals(propName)) { if (hasStringCreator) { throwable = _valueInstantiator.createFromString(ctxt, p.getText()); // any pending values? if (pending != null) { for (int i = 0, len = pendingIx; i < len; i += 2) { prop = (SettableBeanProperty)pending[i]; prop.set(throwable, pending[i+1]); } pending = null; } continue; } } /* As per [JACKSON-313], things marked as ignorable should not be * passed to any setter */ if (_ignorableProps != null && _ignorableProps.contains(propName)) { p.skipChildren(); continue; } if (_anySetter != null) { _anySetter.

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS>package com.fasterxml.jackson.databind.node; import com.fasterxml.jackson.core.*; import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.jsontype.TypeSerializer; import com.fasterxml.jackson.databind.util.RawValue; import java.io.IOException; import java.math.BigDecimal; import java.util.*; /** * Node that maps to JSON Object structures in JSON content. *<p> * Note: class was <code>final</code> temporarily for Jackson 2.2. */ public class ObjectNode extends ContainerNode<ObjectNode> { // Note: LinkedHashMap for backwards compatibility protected final Map<String, JsonNode> _children; public ObjectNode(JsonNodeFactory nc) { super(nc); _children = new LinkedHashMap<String, JsonNode>(); } /** * @since 2.4 */ public ObjectNode(JsonNodeFactory nc, Map<String, JsonNode> kids) { super(nc); _children = kids; } @Override protected JsonNode _at(JsonPointer ptr) { return get(ptr.getMatchingProperty()); } /* Question: should this delegate to `JsonNodeFactory`? It does not absolutely * have to, as long as sub-types override the method but... */ // note: co-variant for type safety @SuppressWarnings("unchecked") @Override public ObjectNode deepCopy() { ObjectNode ret = new ObjectNode(_nodeFactory); for (Map.Entry<String, JsonNode> entry: _children.entrySet()) ret._children.put(entry.getKey(), entry.getValue().deepCopy()); return ret; } /* /********************************************************** /* Overrides for JsonSerializable.Base /********************************************************** */ @Override public boolean isEmpty(SerializerProvider serializers) { return _children.isEmpty(); } /* /********************************************************** /* Implementation of core JsonNode API /********************************************************** */ @Override public JsonNodeType getNodeType() { return JsonNodeType.OBJECT; } @Override public JsonToken asToken() { return JsonToken.START_OBJECT; } @Override public int size() { return _children.size(); } @Override public Iterator<JsonNode> elements() {

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS>package com.fasterxml.jackson.databind.node; import java.io.IOException; import java.math.BigDecimal; import java.math.BigInteger; import com.fasterxml.jackson.core.*; import com.fasterxml.jackson.core.io.NumberOutput; import com.fasterxml.jackson.databind.SerializerProvider; /** * Numeric node that contains 64-bit ("double precision") * floating point values simple 32-bit integer values. */ public class DoubleNode extends NumericNode { protected final double _value; /* /********************************************************** /* Construction /********************************************************** */ public DoubleNode(double v) { _value = v; } public static DoubleNode valueOf(double v) { return new DoubleNode(v); } /* /********************************************************** /* BaseJsonNode extended API /********************************************************** */ @Override public JsonToken asToken() { return JsonToken.VALUE_NUMBER_FLOAT; } @Override public JsonParser.NumberType numberType() { return JsonParser.NumberType.DOUBLE; } /* /********************************************************** /* Overrridden JsonNode methods /********************************************************** */ @Override public boolean isFloatingPointNumber() { return true; } @Override public boolean isDouble() { return true; } @Override public boolean canConvertToInt() { return (_value >= Integer.MIN_VALUE && _value <= Integer.MAX_VALUE); } @Override public boolean canConvertToLong() { return (_value >= Long.MIN_VALUE && _value <= Long.MAX_VALUE); } @Override public Number numberValue() { return Double.valueOf(_value); } @Override public short shortValue() { return (short) _value; } @Override public int intValue() { return (int) _value; } @Override public long longValue() { return (long) _value; } @Override public float floatValue() { return (float) _value; } @Override public double doubleValue() { return _value; } @Override public BigDecimal decimalValue() { return BigDecimal.valueOf(_value); } @Override public BigInteger bigIntegerValue() { return decimalValue().toBigInteger(); } @Override public String asText() { return

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS>based object * conversion through parser/generator interfaces. If null, * such methods can not be used. * * @return Parser that can be used for reading contents stored in this buffer */ public JsonParser asParser(ObjectCodec codec) { return new Parser(_first, codec, _hasNativeTypeIds, _hasNativeObjectIds); } /** * @param src Parser to use for accessing source information * like location, configured codec */ public JsonParser asParser(JsonParser src) { Parser p = new Parser(_first, src.getCodec(), _hasNativeTypeIds, _hasNativeObjectIds); p.setLocation(src.getTokenLocation()); return p; } /* /********************************************************** /* Additional accessors /********************************************************** */ public JsonToken firstToken() { if (_first != null) { return _first.type(0); } return null; } /* /********************************************************** /* Other custom methods not needed for implementing interfaces /********************************************************** */ /** * Helper method that will append contents of given buffer into this * buffer. * Not particularly optimized; can be made faster if there is need. * * @return This buffer */ @SuppressWarnings("resource") public TokenBuffer append(TokenBuffer other) throws IOException { // Important? If source has native ids, need to store if (!_hasNativeTypeIds) { _hasNativeTypeIds = other.canWriteTypeId(); } if (!_hasNativeObjectIds) { _hasNativeObjectIds = other.canWriteObjectId(); } _mayHaveNativeIds = _hasNativeTypeIds | _hasNativeObjectIds; JsonParser p = other.asParser(); while (p.nextToken() != null) { copyCurrentStructure(p); } return this; } /** * Helper method that will write all contents of this buffer * using given {@link JsonGenerator}. *<p> * Note: this method would be enough to implement * <code>JsonSerializer</code> for <code>TokenBuffer</code> type; * but we can not have upwards * references (from core to mapper package); and as such we also * can not take second argument. */ public

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS> void serialize(JsonGenerator gen) throws IOException { Segment segment = _first; int ptr = -1; final boolean checkIds = _mayHaveNativeIds; boolean hasIds = checkIds && (segment.hasIds()); while (true) { if (++ptr >= Segment.TOKENS_PER_SEGMENT) { ptr = 0; segment = segment.next(); if (segment == null) break; hasIds = checkIds && (segment.hasIds()); } JsonToken t = segment.type(ptr); if (t == null) break; if (hasIds) { Object id = segment.findObjectId(ptr); if (id != null) { gen.writeObjectId(id); } id = segment.findTypeId(ptr); if (id != null) { gen.writeTypeId(id); } } // Note: copied from 'copyCurrentEvent'... switch (t) { case START_OBJECT: gen.writeStartObject(); break; case END_OBJECT: gen.writeEndObject(); break; case START_ARRAY: gen.writeStartArray(); break; case END_ARRAY: gen.writeEndArray(); break; case FIELD_NAME: { // 13-Dec-2010, tatu: Maybe we should start using different type tokens to reduce casting? Object ob = segment.get(ptr); if (ob instanceof SerializableString) { gen.writeFieldName((SerializableString) ob); } else { gen.writeFieldName((String) ob); } } break; case VALUE_STRING: { Object ob = segment.get(ptr); if (ob instanceof SerializableString) { gen.writeString((SerializableString) ob); } else { gen.writeString((String) ob); } } break; case VALUE_NUMBER_INT: { Object n = segment.get(ptr); if (n instanceof Integer) { gen.writeNumber((Integer) n); } else if (n instanceof BigInteger) { gen.writeNumber((BigInteger) n); } else if (n instanceof Long) { gen.writeNumber((Long) n); } else if (n instanceof Short) {

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS> gen.writeNumber((Short) n); } else { gen.writeNumber(((Number) n).intValue()); } } break; case VALUE_NUMBER_FLOAT: { Object n = segment.get(ptr); if (n instanceof Double) { gen.writeNumber(((Double) n).doubleValue()); } else if (n instanceof BigDecimal) { gen.writeNumber((BigDecimal) n); } else if (n instanceof Float) { gen.writeNumber(((Float) n).floatValue()); } else if (n == null) { gen.writeNull(); } else if (n instanceof String) { gen.writeNumber((String) n); } else { throw new JsonGenerationException(String.format( "Unrecognized value type for VALUE_NUMBER_FLOAT: %s, can not serialize", n.getClass().getName()), gen); } } break; case VALUE_TRUE: gen.writeBoolean(true); break; case VALUE_FALSE: gen.writeBoolean(false); break; case VALUE_NULL: gen.writeNull(); break; case VALUE_EMBEDDED_OBJECT: { Object value = segment.get(ptr); if (value instanceof RawValue) { ((RawValue) value).serialize(gen); } else { gen.writeObject(value); } } break; default: throw new RuntimeException("Internal error: should never end up through this code path"); } } } /** * Helper method used by standard deserializer. * * @since 2.3 */ public TokenBuffer deserialize(JsonParser p, DeserializationContext ctxt) throws IOException { if (p.getCurrentTokenId() != JsonToken.FIELD_NAME.id()) { copyCurrentStructure(p); return this; } /* 28-Oct-2014, tatu: As per [databind#592], need to support a special case of starting from * FIELD_NAME, which is taken to mean that we are missing START_OBJECT, but need * to assume one did exist. */ JsonToken t; writeStartObject(); do { copyCurrentStructure(p); } while ((t = p.

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS>nextToken()) == JsonToken.FIELD_NAME); if (t != JsonToken.END_OBJECT) { throw ctxt.mappingException("Expected END_OBJECT after copying contents of a JsonParser into TokenBuffer, got "+t); } writeEndObject(); return this; } @Override @SuppressWarnings("resource") public String toString() { // Let's print up to 100 first tokens... final int MAX_COUNT = 100; StringBuilder sb = new StringBuilder(); sb.append("[TokenBuffer: "); /* sb.append("NativeTypeIds=").append(_hasNativeTypeIds).append(","); sb.append("NativeObjectIds=").append(_hasNativeObjectIds).append(","); */ JsonParser jp = asParser(); int count = 0; final boolean hasNativeIds = _hasNativeTypeIds || _hasNativeObjectIds; while (true) { JsonToken t; try { t = jp.nextToken(); if (t == null) break; if (hasNativeIds) { _appendNativeIds(sb); } if (count < MAX_COUNT) { if (count > 0) { sb.append(", "); } sb.append(t.toString()); if (t == JsonToken.FIELD_NAME) { sb.append('('); sb.append(jp.getCurrentName()); sb.append(')'); } } } catch (IOException ioe) { // should never occur throw new IllegalStateException(ioe); } ++count; } if (count >= MAX_COUNT) { sb.append(" ... (truncated ").append(count-MAX_COUNT).append(" entries)"); } sb.append(']'); return sb.toString(); } private final void _appendNativeIds(StringBuilder sb) { Object objectId = _last.findObjectId(_appendAt-1); if (objectId != null) { sb.append("[objectId=").append(String.valueOf(objectId)).append(']'); } Object typeId = _last.findTypeId(_appendAt-1); if (typeId != null) { sb.append("[typeId=").append(String.valueOf(typeId)).append(']'); } } /*

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS> /********************************************************** /* JsonGenerator implementation: configuration /********************************************************** */ @Override public JsonGenerator enable(Feature f) { _generatorFeatures |= f.getMask(); return this; } @Override public JsonGenerator disable(Feature f) { _generatorFeatures &= ~f.getMask(); return this; } //public JsonGenerator configure(SerializationFeature f, boolean state) { } @Override public boolean isEnabled(Feature f) { return (_generatorFeatures & f.getMask()) != 0; } @Override public int getFeatureMask() { return _generatorFeatures; } @Override @Deprecated public JsonGenerator setFeatureMask(int mask) { _generatorFeatures = mask; return this; } @Override public JsonGenerator overrideStdFeatures(int values, int mask) { int oldState = getFeatureMask(); _generatorFeatures = (oldState & ~mask) | (values & mask); return this; } @Override public JsonGenerator useDefaultPrettyPrinter() { // No-op: we don't indent return this; } @Override public JsonGenerator setCodec(ObjectCodec oc) { _objectCodec = oc; return this; } @Override public ObjectCodec getCodec() { return _objectCodec; } @Override public final JsonWriteContext getOutputContext() { return _writeContext; } /* /********************************************************** /* JsonGenerator implementation: capability introspection /********************************************************** */ /** * Since we can efficiently store <code>byte[]</code>, yes. */ @Override public boolean canWriteBinaryNatively() { return true; } /* /********************************************************** /* JsonGenerator implementation: low-level output handling /********************************************************** */ @Override public void flush() throws IOException { /* NOP */ } @Override public void close() throws IOException { _closed = true; } @Override public boolean isClosed() { return _closed; } /* /********************************************************** /* JsonGenerator implementation: write methods, structural /********************************************************** */ @Override public final void writeStartArray() throws IOException { _append(JsonToken.START_ARRAY); _writeContext = _writeContext.createChildArray

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS>Context(); } @Override public final void writeEndArray() throws IOException { _append(JsonToken.END_ARRAY); // Let's allow unbalanced tho... i.e. not run out of root level, ever JsonWriteContext c = _writeContext.getParent(); if (c != null) { _writeContext = c; } } @Override public final void writeStartObject() throws IOException { _append(JsonToken.START_OBJECT); _writeContext = _writeContext.createChildObjectContext(); } @Override public final void writeEndObject() throws IOException { _append(JsonToken.END_OBJECT); // Let's allow unbalanced tho... i.e. not run out of root level, ever JsonWriteContext c = _writeContext.getParent(); if (c != null) { _writeContext = c; } } @Override public final void writeFieldName(String name) throws IOException { _append(JsonToken.FIELD_NAME, name); _writeContext.writeFieldName(name); } @Override public void writeFieldName(SerializableString name) throws IOException { _append(JsonToken.FIELD_NAME, name); _writeContext.writeFieldName(name.getValue()); } /* /********************************************************** /* JsonGenerator implementation: write methods, textual /********************************************************** */ @Override public void writeString(String text) throws IOException { if (text == null) { writeNull(); } else { _appendValue(JsonToken.VALUE_STRING, text); } } @Override public void writeString(char[] text, int offset, int len) throws IOException { writeString(new String(text, offset, len)); } @Override public void writeString(SerializableString text) throws IOException { if (text == null) { writeNull(); } else { _appendValue(JsonToken.VALUE_STRING, text); } } @Override public void writeRawUTF8String(byte[] text, int offset, int length) throws IOException { // could add support for buffering if we really want it... _reportUnsupportedOperation(); } @Override public void writeUTF8String(byte

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS>[] text, int offset, int length) throws IOException { // could add support for buffering if we really want it... _reportUnsupportedOperation(); } @Override public void writeRaw(String text) throws IOException { _reportUnsupportedOperation(); } @Override public void writeRaw(String text, int offset, int len) throws IOException { _reportUnsupportedOperation(); } @Override public void writeRaw(SerializableString text) throws IOException { _reportUnsupportedOperation(); } @Override public void writeRaw(char[] text, int offset, int len) throws IOException { _reportUnsupportedOperation(); } @Override public void writeRaw(char c) throws IOException { _reportUnsupportedOperation(); } @Override public void writeRawValue(String text) throws IOException { _appendValue(JsonToken.VALUE_EMBEDDED_OBJECT, new RawValue(text)); } @Override public void writeRawValue(String text, int offset, int len) throws IOException { if (offset > 0 || len != text.length()) { text = text.substring(offset, offset+len); } _appendValue(JsonToken.VALUE_EMBEDDED_OBJECT, new RawValue(text)); } @Override public void writeRawValue(char[] text, int offset, int len) throws IOException { _appendValue(JsonToken.VALUE_EMBEDDED_OBJECT, new String(text, offset, len)); } /* /********************************************************** /* JsonGenerator implementation: write methods, primitive types /********************************************************** */ @Override public void writeNumber(short i) throws IOException { _appendValue(JsonToken.VALUE_NUMBER_INT, Short.valueOf(i)); } @Override public void writeNumber(int i) throws IOException { _appendValue(JsonToken.VALUE_NUMBER_INT, Integer.valueOf(i)); } @Override public void writeNumber(long l) throws IOException { _appendValue(JsonToken.VALUE_NUMBER_INT, Long.valueOf(l)); } @Override public void writeNumber(double d) throws IOException { _appendValue(JsonToken.VALUE_NUMBER_FLOAT, Double.valueOf(d)); } @Override public void writeNumber

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS>(float f) throws IOException { _appendValue(JsonToken.VALUE_NUMBER_FLOAT, Float.valueOf(f)); } @Override public void writeNumber(BigDecimal dec) throws IOException { if (dec == null) { writeNull(); } else { _appendValue(JsonToken.VALUE_NUMBER_FLOAT, dec); } } @Override public void writeNumber(BigInteger v) throws IOException { if (v == null) { writeNull(); } else { _appendValue(JsonToken.VALUE_NUMBER_INT, v); } } @Override public void writeNumber(String encodedValue) throws IOException { /* 03-Dec-2010, tatu: related to [JACKSON-423], should try to keep as numeric * identity as long as possible */ _appendValue(JsonToken.VALUE_NUMBER_FLOAT, encodedValue); } @Override public void writeBoolean(boolean state) throws IOException { _appendValue(state ? JsonToken.VALUE_TRUE : JsonToken.VALUE_FALSE); } @Override public void writeNull() throws IOException { _appendValue(JsonToken.VALUE_NULL); } /* /*********************************************************** /* JsonGenerator implementation: write methods for POJOs/trees /*********************************************************** */ @Override public void writeObject(Object value) throws IOException { if (value == null) { writeNull(); return; } Class<?> raw = value.getClass(); if (raw == byte[].class || (value instanceof RawValue)) { _appendValue(JsonToken.VALUE_EMBEDDED_OBJECT, value); return; } if (_objectCodec == null) { /* 28-May-2014, tatu: Tricky choice here; if no codec, should we * err out, or just embed? For now, do latter. */ // throw new JsonMappingException("No ObjectCodec configured for TokenBuffer, writeObject() called"); _appendValue(JsonToken.VALUE_EMBEDDED_OBJECT, value); } else { _objectCodec.writeValue(this, value); } } @Override public void writeTree(TreeNode node) throws IOException {

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS> if (node == null) { writeNull(); return; } if (_objectCodec == null) { // as with 'writeObject()', is codec optional? _appendValue(JsonToken.VALUE_EMBEDDED_OBJECT, node); } else { _objectCodec.writeTree(this, node); } } /* /*********************************************************** /* JsonGenerator implementation; binary /*********************************************************** */ @Override public void writeBinary(Base64Variant b64variant, byte[] data, int offset, int len) throws IOException { /* 31-Dec-2009, tatu: can do this using multiple alternatives; but for * now, let's try to limit number of conversions. * The only (?) tricky thing is that of whether to preserve variant, * seems pointless, so let's not worry about it unless there's some * compelling reason to. */ byte[] copy = new byte[len]; System.arraycopy(data, offset, copy, 0, len); writeObject(copy); } /** * Although we could support this method, it does not necessarily make * sense: we can not make good use of streaming because buffer must * hold all the data. Because of this, currently this will simply * throw {@link UnsupportedOperationException} */ @Override public int writeBinary(Base64Variant b64variant, InputStream data, int dataLength) { throw new UnsupportedOperationException(); } /* /*********************************************************** /* JsonGenerator implementation: native ids /*********************************************************** */ @Override public boolean canWriteTypeId() { return _hasNativeTypeIds; } @Override public boolean canWriteObjectId() { return _hasNativeObjectIds; } @Override public void writeTypeId(Object id) { _typeId = id; _hasNativeId = true; } @Override public void writeObjectId(Object id) { _objectId = id; _hasNativeId = true; } /* /********************************************************** /* JsonGenerator implementation; pass-through copy /********************************************************** */ @Override public void copyCurrentEvent(JsonParser p) throws IOException { if (_mayHaveNativeIds) { _checkNativeIds(

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS>p); } switch (p.getCurrentToken()) { case START_OBJECT: writeStartObject(); break; case END_OBJECT: writeEndObject(); break; case START_ARRAY: writeStartArray(); break; case END_ARRAY: writeEndArray(); break; case FIELD_NAME: writeFieldName(p.getCurrentName()); break; case VALUE_STRING: if (p.hasTextCharacters()) { writeString(p.getTextCharacters(), p.getTextOffset(), p.getTextLength()); } else { writeString(p.getText()); } break; case VALUE_NUMBER_INT: switch (p.getNumberType()) { case INT: writeNumber(p.getIntValue()); break; case BIG_INTEGER: writeNumber(p.getBigIntegerValue()); break; default: writeNumber(p.getLongValue()); } break; case VALUE_NUMBER_FLOAT: if (_forceBigDecimal) { /* 10-Oct-2015, tatu: Ideally we would first determine whether underlying * number is already decoded into a number (in which case might as well * access as number); or is still retained as text (in which case we * should further defer decoding that may not need BigDecimal): */ writeNumber(p.getDecimalValue()); } else { switch (p.getNumberType()) { case BIG_DECIMAL: writeNumber(p.getDecimalValue()); break; case FLOAT: writeNumber(p.getFloatValue()); break; default: writeNumber(p.getDoubleValue()); } } break; case VALUE_TRUE: writeBoolean(true); break; case VALUE_FALSE: writeBoolean(false); break; case VALUE_NULL: writeNull(); break; case VALUE_EMBEDDED_OBJECT: writeObject(p.getEmbeddedObject()); break; default: throw new RuntimeException("Internal error: should never end up through this code path"); } } @Override public void copyCurrentStructure(JsonParser jp) throws IOException { JsonToken t = jp.getCurrentToken(); // Let's handle field-name separately first if (t == Json

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS>Token.FIELD_NAME) { if (_mayHaveNativeIds) { _checkNativeIds(jp); } writeFieldName(jp.getCurrentName()); t = jp.nextToken(); // fall-through to copy the associated value } if (_mayHaveNativeIds) { _checkNativeIds(jp); } switch (t) { case START_ARRAY: writeStartArray(); while (jp.nextToken() != JsonToken.END_ARRAY) { copyCurrentStructure(jp); } writeEndArray(); break; case START_OBJECT: writeStartObject(); while (jp.nextToken() != JsonToken.END_OBJECT) { copyCurrentStructure(jp); } writeEndObject(); break; default: // others are simple: copyCurrentEvent(jp); } } private final void _checkNativeIds(JsonParser jp) throws IOException { if ((_typeId = jp.getTypeId()) != null) { _hasNativeId = true; } if ((_objectId = jp.getObjectId()) != null) { _hasNativeId = true; } } /* /********************************************************** /* Internal methods /********************************************************** */ protected final void _append(JsonToken type) { Segment next = _hasNativeId ? _last.append(_appendAt, type, _objectId, _typeId) : _last.append(_appendAt, type); if (next == null) { ++_appendAt; } else { _last = next; _appendAt = 1; // since we added first at 0 } } protected final void _append(JsonToken type, Object value) { Segment next = _hasNativeId ? _last.append(_appendAt, type, value, _objectId, _typeId) : _last.append(_appendAt, type, value); if (next == null) { ++_appendAt; } else { _last = next; _appendAt = 1; } } /** * Similar to {@link #_append(JsonToken)} but also updates context with * knowledge that a scalar value was written * * @since 2.6.4 */ protected final void _

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS>appendValue(JsonToken type) { _writeContext.writeValue(); Segment next = _hasNativeId ? _last.append(_appendAt, type, _objectId, _typeId) : _last.append(_appendAt, type); if (next == null) { ++_appendAt; } else { _last = next; _appendAt = 1; // since we added first at 0 } } /** * Similar to {@link #_append(JsonToken,Object)} but also updates context with * knowledge that a scalar value was written * * @since 2.6.4 */ protected final void _appendValue(JsonToken type, Object value) { _writeContext.writeValue(); Segment next = _hasNativeId ? _last.append(_appendAt, type, value, _objectId, _typeId) : _last.append(_appendAt, type, value); if (next == null) { ++_appendAt; } else { _last = next; _appendAt = 1; } } protected final void _appendRaw(int rawType, Object value) { Segment next = _hasNativeId ? _last.appendRaw(_appendAt, rawType, value, _objectId, _typeId) : _last.appendRaw(_appendAt, rawType, value); if (next == null) { ++_appendAt; } else { _last = next; _appendAt = 1; } } @Override protected void _reportUnsupportedOperation() { throw new UnsupportedOperationException("Called operation not supported for TokenBuffer"); } /* /********************************************************** /* Supporting classes /********************************************************** */ protected final static class Parser extends ParserMinimalBase { /* /********************************************************** /* Configuration /********************************************************** */ protected ObjectCodec _codec; /** * @since 2.3 */ protected final boolean _hasNativeTypeIds; /** * @since 2.3 */ protected final boolean _hasNativeObjectIds; protected final boolean _hasNativeIds; /* /********************************************************** /* Parsing state /********************************************************** */ /** * Currently active segment */ protected Segment _segment

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS>; /** * Pointer to current token within current segment */ protected int _segmentPtr; /** * Information about parser context, context in which * the next token is to be parsed (root, array, object). */ protected JsonReadContext _parsingContext; protected boolean _closed; protected transient ByteArrayBuilder _byteBuilder; protected JsonLocation _location = null; /* /********************************************************** /* Construction, init /********************************************************** */ public Parser(Segment firstSeg, ObjectCodec codec, boolean hasNativeTypeIds, boolean hasNativeObjectIds) { super(0); _segment = firstSeg; _segmentPtr = -1; // not yet read _codec = codec; _parsingContext = JsonReadContext.createRootContext(null); _hasNativeTypeIds = hasNativeTypeIds; _hasNativeObjectIds = hasNativeObjectIds; _hasNativeIds = (hasNativeTypeIds | hasNativeObjectIds); } public void setLocation(JsonLocation l) { _location = l; } @Override public ObjectCodec getCodec() { return _codec; } @Override public void setCodec(ObjectCodec c) { _codec = c; } @Override public Version version() { return com.fasterxml.jackson.databind.cfg.PackageVersion.VERSION; } /* /********************************************************** /* Extended API beyond JsonParser /********************************************************** */ public JsonToken peekNextToken() throws IOException { // closed? nothing more to peek, either if (_closed) return null; Segment seg = _segment; int ptr = _segmentPtr+1; if (ptr >= Segment.TOKENS_PER_SEGMENT) { ptr = 0; seg = (seg == null) ? null : seg.next(); } return (seg == null) ? null : seg.type(ptr); } /* /********************************************************** /* Closeable implementation /********************************************************** */ @Override public void close() throws IOException { if (!_closed) { _closed = true; } } /* /********************************************************** /* Public API, traversal /********************************************************** */ @Override public JsonToken nextToken() throws IOException { // If we are closed, nothing more to do

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS> if (_closed || (_segment == null)) return null; // Ok, then: any more tokens? if (++_segmentPtr >= Segment.TOKENS_PER_SEGMENT) { _segmentPtr = 0; _segment = _segment.next(); if (_segment == null) { return null; } } _currToken = _segment.type(_segmentPtr); // Field name? Need to update context if (_currToken == JsonToken.FIELD_NAME) { Object ob = _currentObject(); String name = (ob instanceof String) ? ((String) ob) : ob.toString(); _parsingContext.setCurrentName(name); } else if (_currToken == JsonToken.START_OBJECT) { _parsingContext = _parsingContext.createChildObjectContext(-1, -1); } else if (_currToken == JsonToken.START_ARRAY) { _parsingContext = _parsingContext.createChildArrayContext(-1, -1); } else if (_currToken == JsonToken.END_OBJECT || _currToken == JsonToken.END_ARRAY) { // Closing JSON Object/Array? Close matching context _parsingContext = _parsingContext.getParent(); // but allow unbalanced cases too (more close markers) if (_parsingContext == null) { _parsingContext = JsonReadContext.createRootContext(null); } } return _currToken; } @Override public String nextFieldName() throws IOException { // inlined common case from nextToken() if (_closed || (_segment == null)) return null; int ptr = _segmentPtr+1; if (ptr < Segment.TOKENS_PER_SEGMENT && _segment.type(ptr) == JsonToken.FIELD_NAME) { _segmentPtr = ptr; Object ob = _segment.get(ptr); // inlined _currentObject(); String name = (ob instanceof String) ? ((String) ob) : ob.toString(); _parsingContext.setCurrentName(name); return name; } return (nextToken() == JsonToken.FIELD_NAME) ? getCurrentName() : null; } @Override public boolean isClosed() { return _closed; } /* /********************************************************** /* Public API, token accessors /********************************************************** */

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS> @Override public JsonStreamContext getParsingContext() { return _parsingContext; } @Override public JsonLocation getTokenLocation() { return getCurrentLocation(); } @Override public JsonLocation getCurrentLocation() { return (_location == null) ? JsonLocation.NA : _location; } @Override public String getCurrentName() { // 25-Jun-2015, tatu: as per [databind#838], needs to be same as ParserBase if (_currToken == JsonToken.START_OBJECT || _currToken == JsonToken.START_ARRAY) { JsonReadContext parent = _parsingContext.getParent(); return parent.getCurrentName(); } return _parsingContext.getCurrentName(); } @Override public void overrideCurrentName(String name) { // Simple, but need to look for START_OBJECT/ARRAY's "off-by-one" thing: JsonReadContext ctxt = _parsingContext; if (_currToken == JsonToken.START_OBJECT || _currToken == JsonToken.START_ARRAY) { ctxt = ctxt.getParent(); } try { ctxt.setCurrentName(name); } catch (IOException e) { throw new RuntimeException(e); } } /* /********************************************************** /* Public API, access to token information, text /********************************************************** */ @Override public String getText() { // common cases first: if (_currToken == JsonToken.VALUE_STRING || _currToken == JsonToken.FIELD_NAME) { Object ob = _currentObject(); if (ob instanceof String) { return (String) ob; } return (ob == null) ? null : ob.toString(); } if (_currToken == null) { return null; } switch (_currToken) { case VALUE_NUMBER_INT: case VALUE_NUMBER_FLOAT: Object ob = _currentObject(); return (ob == null) ? null : ob.toString(); default: return _currToken.asString(); } } @Override public char[] getTextCharacters() { String str = getText(); return (str == null) ? null : str.toCharArray(); } @Override public int getTextLength() { String str = getText(); return

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS> (str == null) ? 0 : str.length(); } @Override public int getTextOffset() { return 0; } @Override public boolean hasTextCharacters() { // We never have raw buffer available, so: return false; } /* /********************************************************** /* Public API, access to token information, numeric /********************************************************** */ @Override public BigInteger getBigIntegerValue() throws IOException { Number n = getNumberValue(); if (n instanceof BigInteger) { return (BigInteger) n; } if (getNumberType() == NumberType.BIG_DECIMAL) { return ((BigDecimal) n).toBigInteger(); } // int/long is simple, but let's also just truncate float/double: return BigInteger.valueOf(n.longValue()); } @Override public BigDecimal getDecimalValue() throws IOException { Number n = getNumberValue(); if (n instanceof BigDecimal) { return (BigDecimal) n; } switch (getNumberType()) { case INT: case LONG: return BigDecimal.valueOf(n.longValue()); case BIG_INTEGER: return new BigDecimal((BigInteger) n); default: } // float or double return BigDecimal.valueOf(n.doubleValue()); } @Override public double getDoubleValue() throws IOException { return getNumberValue().doubleValue(); } @Override public float getFloatValue() throws IOException { return getNumberValue().floatValue(); } @Override public int getIntValue() throws IOException { // optimize common case: if (_currToken == JsonToken.VALUE_NUMBER_INT) { return ((Number) _currentObject()).intValue(); } return getNumberValue().intValue(); } @Override public long getLongValue() throws IOException { return getNumberValue().longValue(); } @Override public NumberType getNumberType() throws IOException { Number n = getNumberValue(); if (n instanceof Integer) return NumberType.INT; if (n instanceof Long) return NumberType.LONG; if (n instanceof Double) return NumberType.DOUBLE; if (n instanceof BigDecimal) return NumberType.BIG_DECIMAL; if (n instanceof BigInteger) return NumberType.BIG_INTEGER; if (n instanceof Float) return NumberType

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS>.FLOAT; if (n instanceof Short) return NumberType.INT; // should be SHORT return null; } @Override public final Number getNumberValue() throws IOException { _checkIsNumber(); Object value = _currentObject(); if (value instanceof Number) { return (Number) value; } // Difficult to really support numbers-as-Strings; but let's try. // NOTE: no access to DeserializationConfig, unfortunately, so can not // try to determine Double/BigDecimal preference... if (value instanceof String) { String str = (String) value; if (str.indexOf('.') >= 0) { return Double.parseDouble(str); } return Long.parseLong(str); } if (value == null) { return null; } throw new IllegalStateException("Internal error: entry should be a Number, but is of type " +value.getClass().getName()); } /* /********************************************************** /* Public API, access to token information, other /********************************************************** */ @Override public Object getEmbeddedObject() { if (_currToken == JsonToken.VALUE_EMBEDDED_OBJECT) { return _currentObject(); } return null; } @Override @SuppressWarnings("resource") public byte[] getBinaryValue(Base64Variant b64variant) throws IOException, JsonParseException { // First: maybe we some special types? if (_currToken == JsonToken.VALUE_EMBEDDED_OBJECT) { // Embedded byte array would work nicely... Object ob = _currentObject(); if (ob instanceof byte[]) { return (byte[]) ob; } // fall through to error case } if (_currToken != JsonToken.VALUE_STRING) { throw _constructError("Current token ("+_currToken+") not VALUE_STRING (or VALUE_EMBEDDED_OBJECT with byte[]), can not access as binary"); } final String str = getText(); if (str == null) { return null; } ByteArrayBuilder builder = _byteBuilder; if (builder == null) { _byteBuilder = builder = new ByteArrayBuilder(100); } else { _byteBuilder.reset(); } _decodeBase64(str,

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS> builder, b64variant); return builder.toByteArray(); } @Override public int readBinaryValue(Base64Variant b64variant, OutputStream out) throws IOException { byte[] data = getBinaryValue(b64variant); if (data != null) { out.write(data, 0, data.length); return data.length; } return 0; } /* /********************************************************** /* Public API, native ids /********************************************************** */ @Override public boolean canReadObjectId() { return _hasNativeObjectIds; } @Override public boolean canReadTypeId() { return _hasNativeTypeIds; } @Override public Object getTypeId() { return _segment.findTypeId(_segmentPtr); } @Override public Object getObjectId() { return _segment.findObjectId(_segmentPtr); } /* /********************************************************** /* Internal methods /********************************************************** */ protected final Object _currentObject() { return _segment.get(_segmentPtr); } protected final void _checkIsNumber() throws JsonParseException { if (_currToken == null || !_currToken.isNumeric()) { throw _constructError("Current token ("+_currToken+") not numeric, can not use numeric value accessors"); } } @Override protected void _handleEOF() throws JsonParseException { _throwInternal(); } } /** * Individual segment of TokenBuffer that can store up to 16 tokens * (limited by 4 bits per token type marker requirement). * Current implementation uses fixed length array; could alternatively * use 16 distinct fields and switch statement (slightly more efficient * storage, slightly slower access) */ protected final static class Segment { public final static int TOKENS_PER_SEGMENT = 16; /** * Static array used for fast conversion between token markers and * matching {@link JsonToken} instances */ private final static JsonToken[] TOKEN_TYPES_BY_INDEX; static { // ... here we know that there are <= 15 values in JsonToken enum TOKEN_TYPES_BY_INDEX = new JsonToken[16]; JsonToken[] t = JsonToken.values(); // and reserve entry 0 for "

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS>not available" System.arraycopy(t, 1, TOKEN_TYPES_BY_INDEX, 1, Math.min(15, t.length - 1)); } // // // Linking protected Segment _next; // // // State /** * Bit field used to store types of buffered tokens; 4 bits per token. * Value 0 is reserved for "not in use" */ protected long _tokenTypes; // Actual tokens protected final Object[] _tokens = new Object[TOKENS_PER_SEGMENT]; /** * Lazily constructed Map for storing native type and object ids, if any */ protected TreeMap<Integer,Object> _nativeIds; public Segment() { } // // // Accessors public JsonToken type(int index) { long l = _tokenTypes; if (index > 0) { l >>= (index << 2); } int ix = ((int) l) & 0xF; return TOKEN_TYPES_BY_INDEX[ix]; } public int rawType(int index) { long l = _tokenTypes; if (index > 0) { l >>= (index << 2); } int ix = ((int) l) & 0xF; return ix; } public Object get(int index) { return _tokens[index]; } public Segment next() { return _next; } /** * Accessor for checking whether this segment may have native * type or object ids. */ public boolean hasIds() { return _nativeIds != null; } // // // Mutators public Segment append(int index, JsonToken tokenType) { if (index < TOKENS_PER_SEGMENT) { set(index, tokenType); return null; } _next = new Segment(); _next.set(0, tokenType); return _next; } public Segment append(int index, JsonToken tokenType, Object objectId, Object typeId) { if (index < TOKENS_PER_SEGMENT) { set(index, tokenType, objectId, typeId); return null; } _next = new Segment(); _next.set(0, tokenType,

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS> objectId, typeId); return _next; } public Segment append(int index, JsonToken tokenType, Object value) { if (index < TOKENS_PER_SEGMENT) { set(index, tokenType, value); return null; } _next = new Segment(); _next.set(0, tokenType, value); return _next; } public Segment append(int index, JsonToken tokenType, Object value, Object objectId, Object typeId) { if (index < TOKENS_PER_SEGMENT) { set(index, tokenType, value, objectId, typeId); return null; } _next = new Segment(); _next.set(0, tokenType, value, objectId, typeId); return _next; } public Segment appendRaw(int index, int rawTokenType, Object value) { if (index < TOKENS_PER_SEGMENT) { set(index, rawTokenType, value); return null; } _next = new Segment(); _next.set(0, rawTokenType, value); return _next; } public Segment appendRaw(int index, int rawTokenType, Object value, Object objectId, Object typeId) { if (index < TOKENS_PER_SEGMENT) { set(index, rawTokenType, value, objectId, typeId); return null; } _next = new Segment(); _next.set(0, rawTokenType, value, objectId, typeId); return _next; } private void set(int index, JsonToken tokenType) { /* Assumption here is that there are no overwrites, just appends; * and so no masking is needed (nor explicit setting of null) */ long typeCode = tokenType.ordinal(); if (index > 0) { typeCode <<= (index << 2); } _tokenTypes |= typeCode; } private void set(int index, JsonToken tokenType, Object objectId, Object typeId) { long typeCode = tokenType.ordinal(); if (index > 0) { typeCode <<= (index << 2); } _tokenTypes |= typeCode; assignNativeIds

JacksonDatabind, 43

<FILEB>
<CHANGES>
import com.fasterxml.jackson.core.JsonToken;
<CHANGEE>
<CHANGES>
<CHANGEE>
<CHANGES>
if (p.hasToken(JsonToken.VALUE_NULL)) {
<CHANGEE>
<CHANGES>
Object id = _valueDeserializer.deserialize(p, ctxt);
<CHANGEE>
<FILEE>
<FILEB> package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; <CHANGES> <CHANGEE> import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * Specialized {@link SettableBeanProperty} implementation used * for virtual property that represents Object Id that is used * for some POJO types (or properties). */ public final class ObjectIdValueProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; return null; } @Override public AnnotatedMember getMember() { return null; } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { deserializeSetAndReturn(p, ctxt, instance); } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { <CHANGES> Object id = _valueDeserializer.deserialize(p, ctxt); <CHANGEE> /* 02-Apr-2015, tatu: Actually, as per [databind#742], let it be; * missing or null id is needed for some cases, such as cases where id * will be generated externally, at a later point, and is not available * quite yet. Typical use case is with DB inserts. */ // note: no null checks (unlike usually); deserializer should fail if one found <CHANGES> if (id == null) { <CHANGEE> return null; } <CHANGES> <CHANGEE> ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver); roid.bindItem(instance); // also: may need to set a property value as well SettableBeanProperty idProp = _objectIdReader.idProperty; if (idProp != null) { return idProp.setAndReturn(instance, id); } return instance; } @Override public void set(Object instance, Object value<SCANS>(index, objectId, typeId); } private void set(int index, JsonToken tokenType, Object value) { _tokens[index] = value; long typeCode = tokenType.ordinal(); if (index > 0) { typeCode <<= (index << 2); } _tokenTypes |= typeCode; } private void set(int index, JsonToken tokenType, Object value, Object objectId, Object typeId) { _tokens[index] = value; long typeCode = tokenType.ordinal(); if (index > 0) { typeCode <<= (index << 2); } _tokenTypes |= typeCode; assignNativeIds(index, objectId, typeId); } private void set(int index, int rawTokenType, Object value) { _tokens[index] = value; long typeCode = (long) rawTokenType; if (index > 0) { typeCode <<= (index << 2); } _tokenTypes |= typeCode; } private void set(int index, int rawTokenType, Object value, Object objectId, Object typeId) { _tokens[index] = value; long typeCode = (long) rawTokenType; if (index > 0) { typeCode <<= (index << 2); } _tokenTypes |= typeCode; assignNativeIds(index, objectId, typeId); } private final void assignNativeIds(int index, Object objectId, Object typeId) { if (_nativeIds == null) { _nativeIds = new TreeMap<Integer,Object>(); } if (objectId != null) { _nativeIds.put(_objectIdIndex(index), objectId); } if (typeId != null) { _nativeIds.put(_typeIdIndex(index), typeId); } } /** * @since 2.3 */ public Object findObjectId(int index) { return (_nativeIds == null) ? null : _nativeIds.get(_objectIdIndex(index)); } /** * @since 2.3 */ public Object findTypeId(int index) { return (_nativeIds == null) ? null : _nativeIds.get(_